Key values in Tweak platform-dependend?

Bert Freudenberg bert at freudenbergs.de
Sun Jan 21 19:32:22 UTC 2007


Am Jan 21, 2007 um 16:58  schrieb Stefan:

> Hi folks,
>
> We are 3 students trying to implement a lil' game in Tweak. In  
> doing so, we have to catch keyboard events using a method like:
>
> onKeyDown: event
>    | keyValue |
>    <on: keyDown>
>    keyValue := event keyValue.
>    Thereby the value of keyValue differs in dependency of the  
> underlying OS. On Windows the keyValue equals the ASCII-values ('A'  
> = 65). On Mac OS we get completely different values, e.g., an 'A'  
> results in 0.
>
> Currently we work around that problem by checking Smalltalk  
> platformName. Does someone know another (and better ;) ) way to  
> resolve it?

Sure. See class CPlatform and subclasses. Just add your own keymaps  
there.

- Bert -





More information about the Squeak-dev mailing list