• 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: NSWindow delegate handling keyboard events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindow delegate handling keyboard events


  • Subject: Re: NSWindow delegate handling keyboard events
  • From: "John C. Randolph" <email@hidden>
  • Date: Sat, 19 Feb 2005 18:06:01 -0800


On Feb 19, 2005, at 9:46 AM, Matt Neuburg wrote:

On Fri, 18 Feb 2005 23:18:00 -0500, "Andrew O'Laughlin" <email@hidden>
said:
Apple's event handling says that a windows delegate is part of the
responder chain, and that the delegate doesn't need to inherit from
NSResponder.

If it says that, then "Apple's event handling" lies.

I'm making a simple application, and subclassing NSWindow seems like
overkill for interpreting a few keyDown and keyUp events. How would my
window's delegate respond to those events? Implementing
keyDown:(NSEvent *)event in the delegate doesn't do the trick though
the documentation seems to imply that it would.

It wouldn't. A window's delegate is not part of the chain.

Actually, it is, but it's after the window itself. In this case, the event is probably getting consumed by the window. IIRC, NSWindow's -keyDown: method just plays a beep sound.


According to the docs:
the full responder chain comprises these objects:

The key window’s first responder and successors, including objects added with setNextResponder:

The key window itself

The key window’s delegate (which need not inherit from NSResponder)

The main window’s first responder and successors, including objects added with setNextResponder:

The main window itself

The main window’s delegate (which need not inherit from NSResponder)

The application object, NSApp

The application object’s delegate (which need not inherit from NSResponder)

-jcr



John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html



_______________________________________________
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


  • Follow-Ups:
    • Re: NSWindow delegate handling keyboard events
      • From: Matt Neuburg <email@hidden>
References: 
 >Re: NSWindow delegate handling keyboard events (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: hosed IBOutlets
  • Next by Date: Re: Listening to bindings
  • Previous by thread: Re: NSWindow delegate handling keyboard events
  • Next by thread: Re: NSWindow delegate handling keyboard events
  • Index(es):
    • Date
    • Thread