[Pharo-project] getting notice of text selection
Hi, How can I get a notice when the selection changes in a PluggableTextMorph? I see no obvious hook. Cheers, Doru -- www.tudorgirba.com "Obvious things are difficult to teach."
Le 14/07/2011 11:15, Tudor Girba a écrit :
Hi,
How can I get a notice when the selection changes in a PluggableTextMorph? I see no obvious hook. AFAIK, no hook in PluggableTextMorph.
When the selection is changed, an editor sends #storeSelectionInParagraph to itself. maybe one can start from here to add a hook. There is also TextMorph>>#selectionChanged but it is more for selection drawing purpose. If I remember well, it is also sent when the textmorph is scrolled. hope it helps Cheers Alain
Cheers, Doru
-- www.tudorgirba.com
"Obvious things are difficult to teach."
Hi, On 14 Jul 2011, at 16:35, Alain Plantec wrote:
Le 14/07/2011 11:15, Tudor Girba a écrit :
Hi,
How can I get a notice when the selection changes in a PluggableTextMorph? I see no obvious hook. AFAIK, no hook in PluggableTextMorph.
When the selection is changed, an editor sends #storeSelectionInParagraph to itself. maybe one can start from here to add a hook.
Great. Thanks. This one worked. So now I have: GLMPluggableTextMorph>>textMorphClass ^ GLMTextMorphForEditView GLMTextMorphForEditView>>editorClass ^ GLMSmalltalkEditor GLMSmalltalkEditor>>storeSelectionInParagraph super storeSelectionInParagraph. self morph ifNotNil: [ self morph editView announceSelectionFrom: self startIndex to: self stopIndex - 1 ] Beautiful. I just hope I won't need to change that in the near future :). Cheers, Doru
There is also TextMorph>>#selectionChanged but it is more for selection drawing purpose. If I remember well, it is also sent when the textmorph is scrolled.
hope it helps Cheers Alain
Cheers, Doru
-- www.tudorgirba.com
"Obvious things are difficult to teach."
-- www.tudorgirba.com "Every now and then stop and ask yourself if the war you're fighting is the right one."
participants (2)
-
Alain Plantec -
Tudor Girba