• 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
Re: Get unmodified character for key matching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get unmodified character for key matching


  • Subject: Re: Get unmodified character for key matching
  • From: "Mills, Steve" <email@hidden>
  • Date: Thu, 27 Mar 2014 19:04:43 +0000
  • Thread-topic: Get unmodified character for key matching

On Mar 27, 2014, at 13:24:33, Ken Thomases <email@hidden> wrote:

> If you want to know what key was pressed in a physical (or pseudo-physical) sense, you should pay attention to the keyCode of the NSEvent.  If you want to know what a given key code maps to with the user's current keyboard layout, you would use UCKeyTranslate() to translate from key code to character.  You specify the modifier keys which should affect translation, and for your purposes you'd specify none.

Add another "duh" to my pile. I was only looking at a method I'd added to our NSMenuItem class extension that takes an NSString for the character, forgetting that the entire NSEvent is sent to the performKeyEquivalent method, of which we override in our menu subclass. I already have code that uses USKeyTranslate, so I can leverage that into there. Thanks.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255


_______________________________________________

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


References: 
 >Get unmodified character for key matching (From: "Mills, Steve" <email@hidden>)
 >Re: Get unmodified character for key matching (From: "Mills, Steve" <email@hidden>)
 >Re: Get unmodified character for key matching (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Get unmodified character for key matching
  • Next by Date: Re: NSInteger/NSUInteger Considerations (64 bit)
  • Previous by thread: Re: Get unmodified character for key matching
  • Next by thread: SplitView autolayout + autosave = proportionally resized views
  • Index(es):
    • Date
    • Thread