Re: Key translate question
Re: Key translate question
- Subject: Re: Key translate question
- From: Mike Paquette <email@hidden>
- Date: Tue, 17 Apr 2007 16:08:11 -0700
On Apr 17, 2007, at 1:38 PM, email@hidden wrote:
Using an eventTapFunction, I am trying to convert a character
received from the tap function to a character based on the keyboard
layout set in the system preferences. Would I use the
UCKeyTranslate function to do this?
Yes, that would be reasonable. Since you are trying to get to a
keyboard layout character for a single keystroke, you may want to
turn off dead key processing by passing kUCKeyTranslateNoDeadKeysMask
to UCKeyTranslate() as the keyTranslateOptions parameter.
Also, I noticed in all the UCKeyTranslate documentation, it states
the 5th argument (keyboardType) should be specified as LMGetKbdType
(). Yet when I go to the latest xCode documentation on LMGetKbdType
(), the page states: "Legacy Document. Important: The information
in this document is obsolete and should not be used for new
development." It's confusing having all the documentation point to
a function only to be told in the xCode documentation that the
function is legacy.
The CGEventRef delivered to the event tap has the keyboard type
included. To retrieve it for use with UCKeyTranslate():
UInt32 keyboardType;
keyboardType = (UInt32) CGEventGetIntegerValueField(event,
kCGKeyboardEventKeyboardType);
Mike Paquette
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden