Keycodes to ascii mapping

Hi,
I want to use key codes for my key bindings, since they are layout independent.

The problem is: i need a way to tell the user which keys do what, and for that i need their ascii value.

Is there a way to convert from key-codes to ascii, so that I can display the key-bindings to the user?

-Ido.

KeyBoard.getKeyName( int keyCode )

Great thanks!

And that works across keyboard layouts, right?

So for example the key code for the lower left key would give getKeyName() ‘z’ for an English keyboard, ‘y’ for a German keyboard and ‘w’ for a French keyboard?

Ah no - that returns the raw key name of the raw key code. The translated codes are supplied in getEventCharacter() - this translates keyboard codes into actual chars. I don’t think we’ve quite got what you need in the API, which is a the availability of a simple mapping of keycodes to characters. Mostly, I think, because we don’t have the sk1llz to do the Mac bit.

Cas :slight_smile:

The alphanumeric & punctuation chars would be enough.

The only thing I care is that it get the right letters according to the current keyboard layout (qwery,qwertz,azerty,dvorak,etc) - ctrl, esc, enter, del and so on are the same on all layouts anyway.