[Pharo-project] keymappings question
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 question is what should I write in the second line? 2. I would like to disable existing shortcuts from the text morph. How should I do that? Cheers, Doru -- www.tudorgirba.com "What we can governs what we wish."
On 12 July 2011 00:24, Tudor Girba <tudor@tudorgirba.com> 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 question is what should I write in the second line?
2. I would like to disable existing shortcuts from the text morph. How should I do that?
+1 id like to know too. I toying with text right now, and wanna give it a fly and make simple editor. Because i really tired to see the state of text. Maybe i'm not getting it, maybe it has to be complex. But i need to learn it myself. -- Best regards, Igor Stasenko AKA sig.
On Mon, Jul 11, 2011 at 6:24 PM, Tudor Girba <tudor@tudorgirba.com> 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."
On 12 July 2011 02:04, Guillermo Polito <guillermopolito@gmail.com> wrote:
On Mon, Jul 11, 2011 at 6:24 PM, Tudor Girba <tudor@tudorgirba.com> 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.
ouch, we definitely need to clean that mess :)
Hope this helps, Guille
Cheers, Doru
-- www.tudorgirba.com
"What we can governs what we wish."
-- Best regards, Igor Stasenko AKA sig.
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.
ouch, we definitely need to clean that mess :)
Yes this is something to definitevely do. Now I would like to focus on removing StringHolder hierarchy first. Stef
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 <tudor@tudorgirba.com> 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."
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 <tudor@tudorgirba.com> 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 <tudor@tudorgirba.com>
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."
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
Guillermo Polito wrote:
Look at the examples (the ones defined by Camillo, Laurent or me) and tell me if they are understandable, hehe.
Where are the examples? I found some methods with <keymap>, and wrote my own using them as a guide, but my ImageMorph subclass is not responding to them. What are the minimum things one has to do to have shortcuts working for a morph class? Thanks. Sean -- View this message in context: http://forum.world.st/keymappings-question-tp3660905p3990184.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Sean P. DeNigris wrote:
What are the minimum things one has to do to have shortcuts working for a morph class?
Nevermind, I got so excited about shortcuts that I forgot to grab keyboard focus on mouse over :) Sean -- View this message in context: http://forum.world.st/keymappings-question-tp3660905p3990226.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (6)
-
Guillermo Polito -
Henrik Sperre Johansen -
Igor Stasenko -
Sean P. DeNigris -
Stéphane Ducasse -
Tudor Girba