andreas.raab at gmx.de
Fri Mar 18 18:59:41 UTC 2005
> Key down events I thought we agreed upon as being Unicode values as the
> result of pressing a key or combination of keys to generate the
> designed unicode value.
Nope. If you will re-read my post then I thought I made it clear that we
have a distinction between keys and characters.
Once more from the beginning: When you press a *key* the key may or may
not generate a *character*. If a character is indeed being generated
then the character is passed to the image as EventKeyChar. For example,
here is a sequence that will generate the "á" character on my keyboard:
keyDown: ´ (accent key)
keyUp: ´ (accent key)
keyStroke: á (accented-a)
Note that the accent *key* did NOT generate an accent *character* - it
was subsumed by the subsequent combination with the A key to generate
the accented á character.
Therefore, the interpretation of the values by Squeak should always be:
Treat all keyDown events as *keys* and NOT as characters and treat all
keyChar/keyStroke events as *characters* and NOT as keys.
Whether the *keys* need translation too depends on your platform - IIRC,
then on Unix platforms there is an explicit call to translate the "raw"
keyboard code into something a little more abstract.
However, you should *never* report a *character* in a keyDown event -
this is really, really broken.
> So on my mac entering 0xB4 gives me ¥ (16rB4 asCharacter)
> I really want that yen symbol in my text and not have tweak launch a
> smalltalk email client, so how do we know the mean if the only thing
> coming up is 0xb4
We know the difference easily by observing that the Yen-*key* will have
a different code from the launch-mail *key* and that the launch-mail
*key* will in all likelyness not generate a *character*.
Therefore, if we have a translation table in the image that says "0xB4
is the launch-mail *key* on the Mac" and, for example, "0xB7 is the Yen
*key* on the Mac", then even though the VM will translate the 0xB7 *key*
into the 0xB4 *character* there is no confusion whatsoever.
We can simply observe keyDown events to watch for the 0xB4 *key* to
launch the email client and we can observe keyStroke events to watch for
the 0xB4 *character* and insert the Yen sign.
More information about the Vm-dev