Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1540
  • Last Modified:

OS X Convert Scan Code to Unicode

I'm working in OSX and I've got an event handler on an OpenGL window. When a key is pressed, I end up with a scancode when I do GetEventParameter(event, kEventParamKeyCode, ...). I want to convert this scancode into unicode based on the keyboard profile. How can I do this?

Thanks.
0
Evlich
Asked:
Evlich
1 Solution
 
clausbrochCommented:
If you use kEventParamUnicodes instead of kEventParamKeyCode you will get the unicode character directly. Mac OS X will automatically take the current keyboard layout into account.

For more information you can have a look at this Q&A from Apple:
http://developer.apple.com/qa/qa2005/qa1446.html
0
 
EvlichAuthor Commented:
Excellent, this is exactly what I'm looking for. Is there a way to discriminate the function keys? They seem to all report Unicode #16.

Thanks.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now