On Mar 31, 2009, at 2:39 AM, Rimas M. wrote:

The code above returns unichar - symbol (!) code 0-65535. While
keyboard layout is US for example, pressing "P" (lowercase, without
shift or any other modifiers) gives code 112 (ASCII lowercase 'p',
ASCII and Unicode 0-255 matches). Meanwhile after switching keyboard
layout to RU (Cyrillic), pressing the same key produces symbol "ะท" (I
am sure on www this symbol will not be displayed) with unichar code
1079. And that is the problem - what I need to do to ensure that
pressing "p" in US and "RU" keyboard layouts will do the same action
in my app.

In that case, you'd want to use the virtual keycode - available as [event keyCode] - rather than the character code. I thought when you'd posted your original question, though, you said that you wanted your keyboard event matching to be dependent on the keyboard layout, so that if you used, for example, a Dvorak keyboard layout, where the 'p' key is generated from the physical key that has an 'r' on it in the US layout, you'd still detect and match against that physical key. That's why I suggested using the character code rather than the keycode.

-eric

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to