how to set the cursor position in TextMorph
Gary Chambers
gazzaguru at btinternet.com
Wed May 10 17:37:33 UTC 2006
How about
myTextMorph setSelection: (7 to: 6)
Or change the range to have a selection instead of a caret.
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org]On Behalf Of Celal
> Ziftci
> Sent: 10 May 2006 3:50 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: how to set the cursor position in TextMorph
>
>
>
> Hi Frank,
> I think I'm getting the meaning of cursor wrong.
> So basicly what I want to do is the following. I want to set the caret
> position in the textmorph using some smalltalk code instead of using the
> mouse.
> As an example, assume I have the following text in a textmorph and | is
> the place my caret is currently at:
>
> smallt|alk
>
> Now I want to move the caret to another place like:
> sm|alltalk
>
> but not by clicking there, using some code instead.
> Is this possible at all? Do I need to imitate firing an event (something
> like mouse down event)?
> Thanks for any help.
>
> - Celal Ziftci
>
>
> ------------------------------------------------------------------
> -------------------------------------------
>
> ------------------------------------------------------------------
> -------------------------------------------
>
> ------------------------------------------------------------------
> -------------------------------------------
>
>
>
> > Hi Celal,
>
>
> > Better to know is what do you want to do. The accessor cursorWrapped:
> > work very well and brings the curosor of the TextMorph to the right
> > position. The little example below is how I try to get the answer on
> > your question.
>
>
> > "initialize the TextMorph"
> > karl := TextMorph new openInWorld. karl contents: 'here comes
> the mouse'.
>
>
> > "Show where the cursor is"
> > Transcript show: karl cursor;cr.
> > "result ==1"
>
>
> > "change the position of the cursor"
> > karl cursorWrapped: 6.
>
>
> > "Show where the cursor is"
> > Transcript show: karl cursor.
> > "result == 6"
>
>
> > Cheers,
> > Frank
>
>
> -------- Original Message --------
> Subject: how to set the cursor position in TextMorph (09-Mai-2006 19:47)
> From: Celal Ziftci <celalziftci at gmail.com>
> To: frank.urbach at schmees.com
>
> >> Hi,
> >> I am having problem in setting the cursor to a certain position in
> >> TextMorph. I am trying the cursorWrapped: message, but it seems to be
> >> not working (or I am misunderstanding its meaning). Any help or
> >> pointers would be appreciated.
> >> Thanks,
> >>
> >> - Celal Ziftci
> >
> >
>
>
More information about the Squeak-dev
mailing list
|