[croquet] Windows keyDown events - numeric pad mapping to alphabet.

orion elenzil oxe at eecs.berkeley.edu
Tue Dec 21 21:49:02 UTC 2004


Thanks for your quick reply Andreas.

Where would be an appropriate place to do this mapping ?

By the time it gets to TeapotMorph >> keyDown:
the value of anEvent keyValue is:

OS  | character pressed | anEvent keyValue
------------------------------------------
XP  | a                 | 65  (aka $A)
OSX | a                 | 97  (aka $a)
------------------------------------------
XP  | num-pad 1         | 97  (aka $a)  <-- the problem
OSX | num-pad 1         | 49  (aka $1)
------------------------------------------
XP  | regular number 1  | 49  (aka $1)
OSX | regular number 1  | 49  (aka $1)

- In short all i have is keyValue = $a,
which there's not much i can do at that point
to distinguish a numeric-pad $a from a legitimate 'a'.

I guess i could exploit the fact that windows
is reporting $A for regular keyboard 'a',
and reporting $a for numeric pad '1',
but that seems a pretty dodgy,
and would require OS-Specific stuff
at a fairly high level of code.

Should i hunt further back in the event-passing chain ?

thanks,
Orion



Andreas Raab andreas.raab-at-gmx.de |squeak devlists| wrote:

> On Windows:
> 
> The values reported in keyDown and keyUp messages are those provided by 
> windows (e.g., the windows-specific VK_MUMBLE) identifiers. The values 
> reported in keyStroke events are (syntesized) ascii characters. For 
> example, pressing shift-2 will generate a keyDown event with VK_SHIFT, a 
> keydown event with VK_2 and then a keyStroke event with $" (composed 
> from shift-2).
> 
> To make sense of the keyDown and keyUp values one must first map them 
> appropriately from their idiosyncratic Windows specific meaning. While 
> for the most common keys (A-Z) the codes generated will be $A through $Z 
> this is not true for any of the other keys (try a function key for 
> example).
> 
> On Mac:
> 
> I have no idea.
> 
> On Unix:
> 
> I have no idea.
> 
> Cheers,
>  - Andreas
> 
> ----- Original Message ----- From: "orion elenzil" 
> <sv04er502 at sneakemail.com>
> To: <squeak-dev at lists.squeakfoundation.org>
> Cc: "croquet devlist" <croquet at lists.services.wisc.edu>
> Sent: Tuesday, December 21, 2004 12:20 PM
> Subject: [croquet] Windows keyDown events - numeric pad mapping to 
> alphabet.
> 
> 
>> Howdy folks.
>>
>> In Squeak 3.6 (Croquet) on windows XP,
>> the keyDown and keyUp events,
>> when handling the numeric keypad,
>> have remapped '123456789' to 'abcdefghi'.
>>
>> (The rest of the numeric pad keys are also
>>  remapped, but the plain numbers are a good example)
>>
>> But not so in the keyStroke event,
>> and not so on Mac OS X.
>>
>> In both of those the keyValue is the expected numeric.
>>
>> I've googles and browsed a bit
>> but haven't found much in the way of clues.
>>
>> Any ideas ?
>>
>> Thanks,
>> Orion
>>
>>
>>
>>
>>
>> ---
>> You are currently subscribed to croquet as: andreas.raab at gmx.de
>> To unsubscribe send a blank email to 
>> leave-croquet-829147N at lists.services.wisc.edu
>>
> 



More information about the Squeak-dev mailing list