Keycodes for non-ASCII keys
Keycodes for non-ASCII keys
- Subject: Keycodes for non-ASCII keys
- From: John Goodman <email@hidden>
- Date: Tue, 21 Sep 2004 11:23:59 -0400
I have an application that posts keystrokes programatically using
CGPostKeyboardEvent. CGPostKeyboardEvent needs a CGKeyCode. I have been
using the KCHR and KeyTranslate, feeding in keycodes and getting back
ASCII values, saving the results in a array which I reference by ASCII
value.
Up until now, I have only been posting ASCII values. But now I need to
send non-ASCII values, like the keycodes for the arrow and function
keys. Since the keycodes are virtual, as a practical matter I can (as a
human being) look up the keycodes values for the keystrokes that I need
to post and save the values as constants. But it seems to me that it
would be better to ask the OS for the keycodes, just as I do for the
ASCII characters.
The problem is that KeyTranslate returns a zero character code for any
non-ASCII keycode. (Which is fair, since there is no character code
for, say, an arrow key.) Is there any way to find out what key (from a
human's perspective) is associated with a given keycode when the key
generates a non-ASCII value? Failing that, is there any header file
that defines the keycodes with sensible names?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden