moving cursor.
Ned Konz
ned at squeakland.org
Mon Dec 8 17:08:08 UTC 2003
On Monday 08 December 2003 12:47 am, Ralph Boland wrote:
> I am using a pluggableTextMorph and in certain
> circumstances I need to move the cursor to a specific
> location. The user's next editing command would then
> start at that location.
>
> 1) I need the cursor to appear to be at the specific location.
> 2) I need the cursor to actually be at that location.
>
> How can I do this? All my efforts so far have been in vain.
Your model can supply a selector that will be used to set the selection.
It should return an Interval.
Look at PluggableTextMorph class>>
on: anObject text: getTextSel accept: setTextSel readSelection:
getSelectionSel menu: getMenuSel
it's the getSelectionSel argument to this method.
Having set this (let's say to #contentsSelection), if your model then says:
self changed: #contentsSelection
the PTM will ask your model for the proper selection interval.
You can also force the selection interval by calling #selectionInterval:
On Tuesday 02 December 2003 6:33 pm, Ralph Boland wrote:
> As part of a gui I have a PluggableTextMorph
> that I allow the user to do standard editing
> functions. (insert/delete text move cursor
> by arrows or mouse). After each user operation
> I need to find out where the mouse cursor is at.
> (I need to collect all the text in the morph up to
> the point where the mouse is but not beyond.
>
> Is there an easy or generally viewed as correct way to do this?
>
Yes, you can look at the selection interval (there is a selectionInterval
instance variable in PluggableTextMorph but for some reason there is no
accessor for it).
More information about the Squeak-dev
mailing list
|