Re: Get unmodified character for key matching
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