• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
virtual keycode to character
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

virtual keycode to character


  • Subject: virtual keycode to character
  • From: "email@hidden" <email@hidden>
  • Date: Mon, 27 Apr 2009 17:46:38 -0700

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


  • Follow-Ups:
    • Re: virtual keycode to character
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: NSTextView re-implementing word wrapping
  • Next by Date: Re: Cocoa application memory leak check
  • Previous by thread: QTMovie -updateMovieFile file size issue
  • Next by thread: Re: virtual keycode to character
  • Index(es):
    • Date
    • Thread