virtual keycode to character
virtual keycode to character
in my app, i allow the user to specify keyboard shortcuts for menu
items (in a manner similar to xcode). for the string passed to
-[MenuItem setKeyEquivalent], i pass the string obtained from the
current event via [NSEvent charactersIgnoringModifiers]. this works
fine almost all the time. however, for some keyboard presses it
doesn't work properly, namely for shift and some of the number keys,
eg., command-! (command exclamation mark) doesn't work as a keyboard
equivalent, but shift-command-1 (shift command one) does work. thus,
i would like a reliable way to go from virtual keycode to the
non-shifted character.
in searching the archives, this topic has come up several times, but
all proposed solutions that i've found make use of one or more
deprecated (in leopard) api calls. eg., LMGetKBDType or
GetScriptManagerVariable, etc.
does anyone have a solution that doesn't rely on any deprecated api calls?
short of a better solution, i may just look at the keycode obtained
from the event and check to see if it corresponds to one of the
constants for number keys from Events.h.
thanx,
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