Hi, This is what I am doing right now and it does not work: (PluggableTextMorph on: textModel ...) onKeyStrokeSend: #keystroke:from: to: textModel ... GLMTextModel>>keystroke: anEvent from: aMorph anEvent anyModifierKeyPressed ifTrue: [ "check the do the shortcut work" ] When it gets to GLMTextModel>>keystroke:from:, the text model is already modified. Cheers, Doru On 13 Jul 2011, at 10:45, Lukas Renggli wrote:
Note that your handler method must return either true or false, depending if it handled the event or not.
Lukas
On 13 July 2011 10:43, Lukas Renggli <renggli@gmail.com> wrote:
In OB we use
aPluggableTextMorph textMorph on: #keyStroke send: #keyStroke: to: self.
Lukas
On 13 July 2011 10:34, Tudor Girba <tudor@tudorgirba.com> wrote:
Hi,
I need a bit of help in trying to add some kind of shortcuts to PluggableTextMorph. The following code used to work for shortcuts like "CMD+o":
(PluggableTextMorph on: textModel ...) onKeyStrokeSend: #keystroke:from: to: textModel GLMTextModel>>keystroke: anEvent from: aMorph anEvent anyModifierKeyPressed ifTrue: [ "check the do the shortcut work" ]
However, in the recent Pharo 1.3, if I press "CMD+o", first the "o" is added to the text as a regular character, and then keystroke:from: is executed.
Is there a way of capturing the event before it gets interpreted by the Morph? Or is there another solution?
Cheers, Doru
-- www.tudorgirba.com
"Every now and then stop and ask yourself if the war you're fighting is the right one."
-- Lukas Renggli www.lukas-renggli.ch
-- Lukas Renggli www.lukas-renggli.ch
-- www.tudorgirba.com "Relationships are of two kinds: those we choose and those that happen. They both matter."