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 On Tue, Jul 12, 2011 at 5:13 AM, Tudor Girba <[email protected]> wrote: > Hi, > > Ahh, I thought that the latest version of Keymappings handles shortcuts per > morph instance. It looks like it does not, and this is bad news for me :(. > > I want to use them in the context of Glamour and for that I need to control > the shortcuts of morph instances. > > How difficult is it to get it working? > > Cheers, > Doru > > > On 12 Jul 2011, at 01:04, Guillermo Polito wrote: > > > > > > > On Mon, Jul 11, 2011 at 6:24 PM, Tudor Girba <[email protected]> > wrote: > > Hi, > > > > I wanted to play with Keymappings, but I got stuck right at the start :). > > > > I have two problems: > > > > 1. I would like to add a simple shortcut (e.g., "$o command") to a text > morph instance. So I have: > > > > textMorph := TextMorph new contents: 'abcdefgh'. > > "what is the magic invocation here ?" > > textMorph openInWindow > > > > The shortcuts are defined via the keymapping pragma. A shortcut is > attached by now to a particular class and not just an instance. Look at the > examples (the ones defined by Camillo, Laurent or me) and tell me if they > are understandable, hehe. > > > > > > The question is what should I write in the second line? > > > > Nothing. Keymappings are "static" right now. > > > > > > > > 2. I would like to disable existing shortcuts from the text morph. How > should I do that? > > > > Look at where the shortcuts are defined for TextMorph and remove the > declarations. And you shold also reset the KMRepository. > > > > But removing keymapping declarations doesn't guarantee the removal in > TextMorph since the default -old- shortcut handling is still there. > Keymapping is just intercepting them by now. > > > > Hope this helps, > > Guille > > > > > > > > Cheers, > > Doru > > > > -- > > www.tudorgirba.com > > > > "What we can governs what we wish." > > > > > > > > > > -- > www.tudorgirba.com > > "Value is always contextual." > > > >
