On 12.07.2011 15:43, Guillermo Polito wrote:
Actually, I was thinking that for custom applications, the right way
is to attach the shortcuts to the model of your morph/application
instead of the morph.
Look at how the shortcuts are attached to the TextMorph. They are
attached to the SmalltalkEditor or TextEditor (instead of TextMorph),
and TextMorph redefines #kmDispatcher to match & delegate to the model.
If you still need shortcuts attached to an specific instance, it
should not be much difficult but I've no time right now to do it :(.
Guille
Small nitpick; SmalltalkEditor/TextEditor are not models of the
TextMorph, they are controllers. (In MVC talk)
Either the view itself, or it's controller should be responsible for
handling key events/shortcuts, not the model (In TextEditors case,
Texts/Paragraphs).
They may call methods of the model as part of that handling, but that's
a different thing :)
Cheers,
Henry