[Pharo-project] Written down current Keyboard Event Model

Guillermo Polito guillermopolito at gmail.com
Thu Jan 26 12:47:33 EST 2012


Maybe this has to be written in the wiki, the book, or something :P.

Keyboard interaction raises 3 events:


   - Keydown

When a key is pressed, it informs the same as a keystroke.  *Nobody uses it
:/.*
Also, between platforms, the keydown events are different ¬¬.
Even more!!  These events are not taken into account by morphic
EventHandler :D.
Just try:

aMorph on: #keyDown send: #value to: [ UIManager inform: 'hello!']


   - Keyup

When a key is released, it informs the same as a keystroke.  *Nobody uses
it :/.*
Also, between platforms, the keyup events are different ¬¬.
Even more!!  Those events are not taken into account in morphic
EventHandler :D.
Just try:

aMorph on: #keyUp send: #value to: [ UIManager inform: 'hello!']


   - Keypress

When a key with a unicode representation is pressed, informs:
 -modifiers.  Hey guess what? If you type ctrl+a character, you'll get
cmd+that character.  Be careful ;).
 -keyCode: a value representing the key pressed (not the character
equivalent)
 -keyCharacter: a character representing the key pressed.  It may not be a
printable character, so, be careful ;).

to subscribe a morph to this event just do:

Even more!!  They are not took into account in morphic EventHandler :D.
Just try:

aMorph on: #keyStroke send: #value to: [ UIManager inform: 'hello!' ].


Guille, messing with events and stuff, and vms, and bored :P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20120126/d9968ac1/attachment-0001.html>


More information about the Pharo-dev mailing list