Re: Need help understanding first responder and multiple nibs
Re: Need help understanding first responder and multiple nibs
- Subject: Re: Need help understanding first responder and multiple nibs
- From: Quincey Morris <email@hidden>
- Date: Tue, 3 Aug 2010 16:43:12 -0700
On Aug 3, 2010, at 15:45, Jason Bruce wrote:
> Passing in a reference to the document did the trick. But I'm still confused as
> to why the 2d Nib isn't in the responder chain.
As I said before, nibs aren't in the responder chain. Anyway, your problem was that the *document* wasn't in the responder chain. That's because a document-linked window controller wasn't in the responder chain. (A window controller is the only object, amongst the various classes related to the responder chain, that has a link to the relevant document.) And that's because the window controller that was in the responder chain wasn't linked to a document.
> The docs say that the responder
> chain would start at the key window; proceed to the main window; and then thru
> MyDocument, NSApplication, etc. Wouldn't the second window be a key window and
> the first one the main window?
No. In general, making a window frontmost makes it both key and main. Only in very specific circumstances can a window become key without becoming main. (A floating inspector window is an example.)
> The NSWindowController for nib #2 was declared
> in MyDocument.h w/@class . . . , and called by MyDocument.m.
It doesn't matter what source file it was defined in, nor what it's "called by". (I assume you mean "created by".)
If you want to have both of your window controllers linked to your document -- which is perfectly valid, though not necessarily a good interface design choice -- use NSDocument's 'addWindowController:' to establish the link, just after creating the second window controller. But if you choose this route, you're responsible for the housekeeping: removing the window controller later when the extra window closes, naming the windows so that it's clear which Window menu item refers to which window, and managing whether the closing of each window also closes the document.
To follow this even further, we'd need to know what you're trying to achieve. If, in fact, you're trying to implement a document inspector window, a different approach would be appropriate.
_______________________________________________
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