[Vm-beginners] KeyboardEvent differences between platforms

Guillermo Polito guillermopolito at gmail.com
Sun Nov 6 14:07:36 UTC 2011


In TextEditor>>initializeShiftCmdKeyShortcuts the shortcuts are set in a
way that it creates three handlers for each shortcut to make it work xD.

The main difference here is that in Linux, ubuntu 11.04 the Ctrl+a comes
with the right keyCharacter, but in Windows and MacOS it does not :(.
We've tested that on host OSs with friends :).

I've captured the problem I'm experimenting so far and wrote down an ugly
hack in this method.

KeyboardEvent>>modifiedCharacter
    self flag: #hack.
    "Hack me.  When Ctrl is pressed, the key ascii value is not right and
we have to do this shit"
    ^(self controlKeyPressed and: [ (#(MacOSX Windows) includes: Smalltalk
os current platformFamily) and: [ keyValue <= 26 ]])
        ifTrue: [ (self keyValue + $a asciiValue - 1) asCharacter ]
        ifFalse: [ self keyCharacter ]


But I'd like to replace that by:

KeyboardEvent>>modifiedCharacter
    ^self keyCharacter

:P


Are there any technical reasons why the Sensor behaves like that?  How
difficult is it to make it work the same for all three vms?

Thanks!
Guille
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-beginners/attachments/20111106/a6458aa7/attachment.htm


More information about the VM-beginners mailing list