i would like to convert a character to its corresponding virtual keycode.

the why: i allow users to specify keyboard equivalents for menu items (in a manner similar to xcode key binding preferences). for reasons i don't understand it works better use unshifted characters for the shifted numeric keys. ie, command-shift-1 works for me, whereas command-! (command-exclamation mark) does not.

additonally, my app is fully scriptable and i allow the user to specify the keyboard shortcut via an applescript. thus, i would like to convert a script specification of command-exclamation mark to command-shift-1 (command-shift-one).

the only way i can think to perform this conversion is to itereate over the virtual key codes 0-127 (with various combinations of shift and option keys) until i find the one that matches the user input character.

and while this is certainly doable, it feels awfully clumsy (and potentially slow).

is there a better way?

thanx,
ken
_______________________________________________

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