• 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: Where's the NSWindowController in a default document-based app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where's the NSWindowController in a default document-based app


  • Subject: Re: Where's the NSWindowController in a default document-based app
  • From: James DiPalma <email@hidden>
  • Date: Mon, 21 Jun 2004 10:37:51 -0700

I agree with Mike that an application's ordered list of objects that are asked to handle nil-targeted action messages should not be called a responder chain; especially since there is a subtle but significant difference in how events traverse a responder chain and how nil-targeted action messages traverse this ordered list.

However, in Apple's documentation titled "Event and Action Messages in the Responder Chain", this line suggests that Apple is documenting this list as "full responder chain":

"In the case of an untargeted action message, where the target is nil, sendAction:to:from: searches the full responder chain for an object that implements the action method specified."


-jim



Also, just one minor nit with Jim's explanation (hi Jim!):

FYI, full responder chain when a simple textfield is first responder within a document's window (default Xcode document based application):

NSTextView:0xe46bb0
_NSKeyboardFocusClipView:0x1a8120
NSTextField:0x1b01a0
NSView:0x1b00f0
NSWindow:0xe310e0
NSWindowController:0x1abee0
WindowDelegate:0xe36500
NSWindowController:0x1abee0
MyDocument:0x1ab850
NSApplication:0x79130
ApplicationDelegate:0x5efa0
NSDocumentController:0x1878d0


This is not the true responder chain (as defined by -nextResponder return values). The true responder chain of the key window is:

NSTextView:0xe46bb0
_NSKeyboardFocusClipView:0x1a8120
NSTextField:0x1b01a0
NSView:0x1b00f0
NSWindow:0xe310e0
NSWindowController:0x1abee0

For event processing, this is who will get a shot at events. For action method dispatch, however, Cocoa does some extra stuff. NSWindow will check with its delegate for action forwarding. NSWindow will also check with the document of the window. NSApplication is also given a shot at action messages and, in turn, it offers them to its delegate and to NSDocumentController.

So, for nil-targetted action methods, Jim's list is right on. But it is not the true responder chain. (The -nextResponder of the NSWindow is indeed the NSWindowController, but the NSWindowController's -nextResponder is nil.

The extra stuff for action dispatch is largely implemented through NSApplication's -targetForAction:to:from: and related methods.

Mike
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Where's the NSWindowController in a default document-based app (From: Glen Low <email@hidden>)
 >Re: Where's the NSWindowController in a default document-based app (From: Izidor Jerebic <email@hidden>)
 >Re: Where's the NSWindowController in a default document-based app (From: James DiPalma <email@hidden>)
 >Re: Where's the NSWindowController in a default document-based app (From: Izidor Jerebic <email@hidden>)
 >Re: Where's the NSWindowController in a default document-based app (From: Mike Ferris <email@hidden>)

  • Prev by Date: NSTextView woes
  • Next by Date: Re: NSTextView woes
  • Previous by thread: Re: Where's the NSWindowController in a default document-based app
  • Next by thread: Re: Where's the NSWindowController in a default document-based app [SOLVED]
  • Index(es):
    • Date
    • Thread