Re: catching modifier keys in a keydown event
Re: catching modifier keys in a keydown event
- Subject: Re: catching modifier keys in a keydown event
- From: Matt Neuburg <email@hidden>
- Date: Sat, 01 Jul 2006 06:56:46 -0700
- Thread-topic: catching modifier keys in a keydown event
On Fri, 30 Jun 2006 20:45:13 -0400, Travis Siegel <email@hidden>
said:
>My keydown event is like this:
>- (BOOL) onKeyDown: (NSEvent *)theEvent
>========= [snip]
>What I can't figure out is how to pickup a key like command-L, or
>something more complex command-option-L.
There is no built-in Cocoa selector called "onKeyDown:", so you are not
revealing very clearly how you are expecting your code to be called.
However, be that as it may, the answer to your question is that you have to
understand two things: (1) the responder chain, and (2) the special
treatment of command-keys. These are very clearly explained in the
documentation, so the best thing is to read it:
...Cocoa/Conceptual/CocoaFundamentals/CoreAppArchitecture/chapter_7_section_
6.html
...Cocoa/Conceptual/BasicEventHandling/Concepts/AboutRespChain.html
And, most critically for your purposes:
...Cocoa/Conceptual/BasicEventHandling/Concepts/KeyEventPath.html
...Cocoa/Conceptual/BasicEventHandling/Concepts/KeyEquiv.html
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden