Re: awakeFromNib and windowWillLoad : basic question
Re: awakeFromNib and windowWillLoad : basic question
- Subject: Re: awakeFromNib and windowWillLoad : basic question
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 09 Jul 2003 06:26:19 -0400
on 03-07-09 5:38 AM, jean Bousquet at email@hidden wrote:
>
> (4) At some point, you send MyWindowController the -showWindow: action
>
> message. This should display MyWindow automatically, and
>
> MyWindowController should receive both -windowWillLoad and
>
> -windowDidLoad as part of that display process.
>
>
>
No, it doesn't.
I believe the explanation goes something like this:
Many windows are specified to remain in memory once they're loaded. For
these windows, showWindow: and other commands will load the window only the
first time, but not afterwards because the window is already loaded. If it
is already loaded, then of course the windowDidLoad and windowWillLoad
delegate methods won't be called.
Thus, if some method you called previously already loaded the window (i.e.,
loaded its nib file), then these delegate methods won't be called at the
next point in your logic even though you call showWindow:.
You can change this behavior in IB or code to specify that a window is
released whenever it is closed. Then it will have to be reloaded every time
it is shown, and the appropriate delegate methods will be called every time.
But the price you pay for this programming convenience is the extra time it
takes to reload the window.
See the reference document for NSWindowController's -window method and
NSWindow's setReleasedWhenClosed: method.
Another option is to detect when a window is activated or becomes visible,
but I believe there are some delegate methods that would be useful in this
context that don't exist in Cocoa.
Sorry to be so vague, but it isn't fresh in my mind.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
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.