• 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: Handling key equivalents in a controller class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Handling key equivalents in a controller class? (From: Matt Neuburg <email@hidden>)
 >Re: Handling key equivalents in a controller class? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Outline View not retaining objects it uses. Why?
  • Next by Date: Re: Drawer examples?
  • Previous by thread: Re: Handling key equivalents in a controller class?
  • Next by thread: Re: Handling key equivalents in a controller class?
  • Index(es):
    • Date
    • Thread