> On 2014/05/29, at 13:57, Alex Hall <mehg...@icloud.com> wrote:
> 
> Hello list,
> I have a subclass of NSView that is set to be my window's first responder. It 
> intercepts keystrokes by implementing keyUp: and performKeyEquivalent: but it 
> doesn't do quite what I need

You need to read the event programming guide and then read it again. 
Views don't receive all key events and they don't get first shot at them 
either. 

In short, you're going to want to look at either NSEvent's global or local 
monitor 
Or
CGEventTap

Most of what you do id the same either way. 

Biggest gotchas are that some key events are intercepted and handled at the 
IOKit level. (Media Keys)
And that Function and modifier keys are approached differently. 
And that arrow keys are numpad keys. 
And some keys exist on on some keyboard layouts and not others. Localized 
keyboards. 

Also carefully consider input methods, by intercepting events you can actually 
be intercepting them before they are converted to what the user intends with 
multistage input ( Japanese for example )
This may or may not be ok. 

Definitely be cautious in thinking in terms of key codes. 
Key codes by the way are mostly documented in Carbon headers but can be useful 
practically. 

It's not really well documented but there are a lot of responder methods that 
are part of the Cocoa text system that can enable a lot of customization. They 
also alleviate the sandbox issues that can arise with monitors and event taps. 
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to