Re: awakeFromNib and windowWillLoad : basic question
Re: awakeFromNib and windowWillLoad : basic question
- Subject: Re: awakeFromNib and windowWillLoad : basic question
- From: jean Bousquet <email@hidden>
- Date: Wed, 09 Jul 2003 18:10:51 +0200
Hello,
At this time of the discussion, the point is :
Is this rule correct and general or did I any thing wrong ?
The windowControllers of the windows both defined in the MainMenu.nib
file (no matter if the window is or not visible at launch time, no matter if
the window has or not the option "released when closed" in IB) never are
sent neither -windowDidLoad (nor -windowWillLoad).
See details below.
>
From: Bill Cheeseman <email@hidden>
>
To: Cocoa-Dev Mail <email@hidden>
>
>
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:.
I never called myself any method before -showWindow. As the windowController
is instantiated in the MainMenu.nib file at launch time, it should be loaded
automatically. Use of -showWindow (first time or not) does never trigger
neither -windowDidLoad nor -windowWillLoad.
>
>
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.
I choiced this option (released when closed) in IB but the behavior is not
changed.
So the rule seems to be still valid :
The windowControllers of the windows both defined in the MainMenu.nib
file (no matter if the window is or not visible at launch time, no matter if
the window has or not the option "released when closed" in IB) never are
sent -windowDidLoad (nor -windowWillLoad).
Is that correct or did I any thing wrong ?
>
>
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.
_______________________________________________
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.