Re: Panels shared by documents
Re: Panels shared by documents
- Subject: Re: Panels shared by documents
- From: Matt Neuburg <email@hidden>
- Date: Fri, 21 Jun 2002 11:44:16 -0700
On Thu, 20 Jun 2002 21:59:32 -0400, Itrat Khan <email@hidden> said:
>
>
On Thursday, June 20, 2002, at 04:09 PM, Brent Gulanowski wrote:
>
>
> What is the most effective mechanism for a panel associating itself
>
> with the current active document? I suppose the app delegate/controller
>
> could listen for window activation notifications, find the document for
>
> the window, and make sure that the active panel(s) were showing the
>
> right document's data. How does it find the right document? ... or ...
>
>
That's about right, but instead of listening to window activation
>
notifications, implement the panel's windowDidUpdate: delegate method,
>
query [NSApp mainWindow] to get the current document
How's that going to help? The panel's windowDidUpdate: delegate method will
be called when the panel updates. But that's not what Brent needs to know;
he needs to know when a different main document becomes active. It seems to
me his original proposal to listen for window activation notifications is
exactly right - this is just what notifications are for. Look, for
instance, at the shared panel in the Learning Cocoa book example; it
listens for an NSWindowDidBecomeMainNotification to learn what document to
associate itself with. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.