re:Croquet Keyboard Oddness on a Mac

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

re:Croquet Keyboard Oddness on a Mac

Dominique Dutoit-2
Hi,

According to Apple's documentation [1], keyDown: receives the correct value for the up arrow code. In the case of the keyStroke: event, it seems that the raw codes are translated by the VM to values corresponding to ascii characters. For example, if the the ] key is pressed, the keyDown: event key value is 30 but the keyStroke: event key value is 93 and (Character value: 93) returns $].

This effect is visible by modifying CroquetEvent>>keyValue:

keyValue: kval
        Transcript show: kval.
        keyValue := kval.

Now, by pressing and releasing any key, the Transcript will show three values: the first one if the value received on a key down event, the second on a key stroke and the third on a key up.

A possible way to handle key events across different platforms is to virtualize the codes just like Tweak does with the CPlatform subclasses and CKeyboardDispatchTable.

[1] http://developer.apple.com/documentation/mac/Text/Text-571.html#MARKER-9-12