PluggableTextMorph - getSelection

Ned Konz ned at bike-nomad.com
Mon Jul 14 05:15:21 UTC 2003


On Sunday 13 July 2003 01:48 pm, Ingo Hohmann wrote:
> How do I work with the selection in a PluggableTextMorph?
>
> When I use myTextField getSelection, I get an #(1 to: 0) returned.

That's because your model hasn't set a selection. That is, if the 
model says:

	self changed: #getSelection.

(or whatever the getSelectionSelector is set to), the PTM will go back 
to the model and ask it for its selection.

If you want to get to the selection set by the user (as opposed to a 
selection set by the model, as above), you have to talk to the PTM's 
editor, if any.

That is, you can do something like this:

myPTM text copyFrom:
myPTM selectionInterval first to: myPTM selectionInterval last

In Connectors, I defined a #selection method on TextMorph that did 
this.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list