Re: Handling key equivalents in a controller class?
Re: Handling key equivalents in a controller class?
- Subject: Re: Handling key equivalents in a controller class?
- From: Jeff Johnson <email@hidden>
- Date: Sat, 19 Jul 2008 18:09:49 -0500
On Jul 19, 2008, at 2:34 PM, Jens Alfke wrote:
On 19 Jul '08, at 8:52 AM, Matt Neuburg wrote:
Try it and see. Let's say we want to catch Esc directed to the
window as a
whole (to exit full screen mode, if I recall your example). So
what I would
do is to insert an NSResponder instance behind the window in the
chain and
implement keyDown:.
I had already tried implementing keyDown: in my controller object,
which is the window's delegate, to no avail. But that class is just
a direct subclass of NSObject, not NSResponder or
NSWindowController. I tried changing its superclass to NSResponder,
but that didn't help.
Looks like I need to read up on the conceptual docs about the
responder chain, to figure out how to make my object the window's
next responder. (I've never manipulated the chain directly before.)
As I said earlier, "NSWindow does pass keyDown: to its
NSWindowController if it doesn't handle the key itself." In other
words, the window controller (or whatever the next responder is) will
*not* receive keyDown: if the window handles the key itself, which
seems to be the case with the Esc key. Thus, you'll need to do
something like subclassing NSWindow in order to catch the key.
-Jeff
_______________________________________________
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