Subject: Shortcut handling in different keyboard layouts



Hello,

I have a question about how properly keyboard shortcuts should be
handled. For example "pressing key X performs action W". How to ensure
that this will work with all keyboard layouts (Cyrillic etc)?
Currently I am checking key down event characters, but that is a wrong
way, because when layout is changed to Cyrillic that does not work. I
thought that would be great to use keyCode to check which action
should be performed. But then I remembered German keyboard layout - it
has Z and Y mixed. Keyboard button, which has label "Z" in US layout
produces keyCode 6, and button with label "Y" produces 16. In German
layout codes are the same, but labels swapped.
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. 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?
Help would be very appreciate.

Regards,

Rimas M.
_______________________________________________

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)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/maillists%40codeha.us

This email sent to maillists@xxxxxxxxx

...



Privacy