Re: Shortcut handling in different keyboard layouts
Re: Shortcut handling in different keyboard layouts
- Subject: Re: Shortcut handling in different keyboard layouts
- From: Eric Schlegel <email@hidden>
- Date: Thu, 26 Mar 2009 20:44:56 -0700
On Mar 26, 2009, at 10:16 AM, Rimas M. wrote:
Take iTunes as example. With US layout enabled, pressing Cmd+Y calls
Preferences. Meanwhile to do the same in German layout you need to
press also Cmd+Y, but "Y" button is not the same as in US and produces
different code.
In this particular case, the command key matching functionality is
provided by the OS (HIToolbox specifically), and the matching code
uses character codes, not keycodes.
I am wondering - how to check incoming key down events
to achieve that functionality. I am sure, that checking characters is
wrong way. Better would be to check keyCodes, but not perfect. Is
there a third way in Cocoa?
In general, using character codes is the most appropriate way. It lets
the matching code automatically adapt to whatever the current keyboard
layout may be. If you check the character code, it doesn't matter
which physical key you've pressed.
-eric
_______________________________________________
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