Re: virtual keycode to character
Re: virtual keycode to character
- Subject: Re: virtual keycode to character
- From: Ken Thomases <email@hidden>
- Date: Wed, 29 Apr 2009 19:22:07 -0500
On Apr 29, 2009, at 6:40 PM, email@hidden wrote:
thank you. this solved my problem.
You're welcome. I'm glad I could help.
and for the archives (to help anyone in the future), here is my code:
UInt32 deadKeyState = 0;
UniCharCount actualCount = 0;
UniChar baseChar;
TISInputSourceRef sourceRef =
TISCopyCurrentKeyboardLayoutInputSource();
CFDataRef keyLayoutPtr =
(CFDataRef)TISGetInputSourceProperty( sourceRef,
kTISPropertyUnicodeKeyLayoutData);
CFRelease( sourceRef);
UCKeyTranslate( (UCKeyboardLayout*)CFDataGetBytePtr(keyLayoutPtr),
[theEvent keyCode],
kUCKeyActionDown,
0,
LMGetKbdLast(),
Why LMGetKbdLast rather than LMGetKbdType? I think that the "Last" in
LMGetKbdLast means "former". That is, if the keyboard is switched at
some point, then LMGetKbdType gives the current keyboard type and
LMGetKbdLast gives the previous keyboard type.
kUCKeyTranslateNoDeadKeysBit,
&deadKeyState,
1,
&actualCount,
&baseChar);
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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