• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Keycodes for non-ASCII keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Geometry problem (slightly OT)
  • Next by Date: Re: Geometry problem (slightly OT)
  • Previous by thread: Re: Geometry problem (slightly OT)
  • Next by thread: Deployment Application will not start
  • Index(es):
    • Date
    • Thread