Re: Shortcut handling in different keyboard

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.



Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)

Help/Unsubscribe/Update your Subscription:

This email sent to maillists@xxxxxxxxx