[squeak-dev] The Inbox: Kernel-mt.1287.mcz
Marcel Taeumel
marcel.taeumel at hpi.de
Mon Dec 16 14:54:20 UTC 2019
> Morphic is a GUI. Its input handler should not have to deal with host-specific modifiers and just map keycodes to selectors (commands).
The representation of such user-input events is not necessarily specific to Morphic, only that #keyStroke: interface is. In the long term, it would be nice to move "UserInputEvent" etc. out of Morphic into its own base package. This is a matter of finding a consistent, object-oriented representation for user-input events. :-)
I think the acual question is whether CTRL is a modifier key or not. As it appears here, CTRL does not only modify a key (character) but actually *modifies* a key (character). :-D Then, again, SHIFT does this, too. Hmmm...
Best,
Marcel
Am 16.12.2019 15:47:57 schrieb K K Subbu <kksubbu.ml at gmail.com>:
On 16/12/19 3:54 PM, Marcel Taeumel wrote:
> MyMorph >> #handlesKeyboard: evt
> ^ true
> MyMorph >> #keyStroke: evt
> (evt controlKeyPressed and: [evt keyCharacter = $c])
> ifTrue: [self terminateApplication].
>
> Why? Because there might be the requirement to "terminate on ctrl+c" for
> some application and it would be nice if one could just implement it
> that way. :-)
Morphic is a GUI. Its input handler should not have to deal with
host-specific modifiers and just map keycodes to selectors (commands).
VM input plugin will parse CTRL+Q into keycode 16r11 to Squeak. Morphic
input handler will map this keycode to, say, #quitKey. so you should
just be able to write:
MyMorph>>quitKey
self terminateApplication
Later if we want to allow ALT+Q also to quit, then we just need to add a
single entry to the Morphic keycode map.
> But maybe I am confusing "characters" and "keys" again. Happens way too
> quickly.
It happens to me too, especially when working late into the night ;-).
I think of a keycode as a SmallInt (or sequence of SmallInts) that
encodes a Character or Symbol (selector), just like a machine word
encoding integer or oop.
Regards .. Subbu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191216/b5aedc5e/attachment.html>
More information about the Squeak-dev
mailing list
|