Re: [NEWBIE QUESTION] What message is sent when window contents finish loading? (revisited)
Re: [NEWBIE QUESTION] What message is sent when window contents finish loading? (revisited)
- Subject: Re: [NEWBIE QUESTION] What message is sent when window contents finish loading? (revisited)
- From: mw <email@hidden>
- Date: Sun, 29 Sep 2002 18:24:17 -0400
mw wrote:
>
>> Well, I'm not sure if it is. The main window has all of its functions
>
>> in the
>
>> default MyDocument class which PB sticks in the project by default
>
>> when you
>
>> make a new document-based cocoa app. MyDocument is a subclass of
>
>> NSDocument.
>
>> Should I, perhaps, create another class that is a subclass of
>
>> NSWindowController, and then just make an instance of MyDocument in
>
>> it? If I
>
>> did that, would I have to change the class of File's Owner in
>
>> MyDocument.nib
>
>> (which contains the main window and such)?
Carlos A. Weber wrote:
>
> Ah, yes... I keep forgetting that the template is set up that way. I
>
> have followed the model set forth in Vermont Recipes (an excellent
>
> series of tutorials by Bill Cheeseman, available at www.stepwise.com),
>
> in which the "controller" tasks are divided between the NSDocument
>
> subclass and the NSWindowController subclass. If you do it this way,
>
> you do indeed change the custom class of File's Owner. A lot of things
>
> (including the ability to use the -windowDidLoad method) become simpler
>
> when you do it this way. Check out the Vermont Recipes tutorials!
>
>
>
Okay, I went to that website and followed the tutorial. It helped a little.
>
There are still some confusing points for me to pick up on. The overall
>
structure of the messaging in this form is still slightly confusing because I
>
had been storing all of the functions in the NSDocument subclass, and now
>
everything had to be moved to the new NSWindowController subclass... But
>
hopefully I'll get it eventually ;-).
>
Thanks for your help! Stepwise.com has a lot of other resources on it that I
>
had been searching for, but had never found.
As more of a follow-up, I finally figured everything out in regards to this
new application structure. Now I have revisited the original program,
executing code as soon as the window is open and visible.
In some cases, a sheet needs to be displayed (if there are overdue bills)
after the check (which takes place in the -windowDidLoad method in the
NSWindowController subclass). But for some reason, -windowDidLoad is called
BEFORE the window is really loaded. Whenever the program attempts to drop
the sheet from the main window, this error occurs (during runtime):
2002-09-29 17:07:33.790 Bill Manager[998] *** Assertion failure in
-[NSApplication
_commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelec
tor:contextInfo:], AppKit.subproj/NSApplication.m:2524
2002-09-29 17:07:33.860 Bill Manager[998] Modal session requires modal
window
It would seem that the sheet cannot be dropped because the window isn't in
"modal session" yet. In the debugger, the window isn't even visible when the
line of code that produces this error is executed.
So, does anybody have any suggestions? Is there another method out there
that is called after the window is REALLY loaded and ready to receive
messages (or at least after its "modal session" has been started)?
Thanks,
mw
_______________________________________________
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.