Re: [NEWBIE QUESTION] What message is sent when window contents finish loading?
Re: [NEWBIE QUESTION] What message is sent when window contents finish loading?
- Subject: Re: [NEWBIE QUESTION] What message is sent when window contents finish loading?
- From: "Carlos A. Weber" <email@hidden>
- Date: Sat, 28 Sep 2002 20:44:50 -1000
On Saturday, Sep 28, 2002, at 11:24 Pacific/Honolulu, mw wrote:
On 9/28/02 1:29 PM, "Carlos A.Weber" <email@hidden> wrote:
On Saturday, Sep 28, 2002, at 04:15 Pacific/Honolulu, mw wrote:
..... [clipped] .......
Here's where the problem comes in. The function that checks for
overdue
bills needs to be called as soon as a file opens and everything is
loaded
in. If there are any overdue bills, then the sheet drops (I have an
instance
of the sheet's window controller in the MyDocument class). But, it
seems
that the function is getting called BEFORE the window is even loaded,
even
though I have the message being sent in my - (void)awakeFromNib
function.
The sheet won't drop, and the table won't highlight (remember, this
is
all
in the NSDocument subclass that is linked to the main window). I have
also
tried putting the method call in windowControllerDidLoadNib, but that
didn't
work either (in fact, putting it in windowControllerDidLoadNib
caused a
SIGBUS 10 error and the program to shut down).
How am I supposed to do this? Is there another function that I need
to
overload that I don't know about yet? I am planning on making serious
applications with Cocoa, but I am using these tester applications to
iron
out what I know, and I know for sure that I will need to be able to
do
what
I am describing (of course, it probably won't involve notifying if a
bill is
overdue, but you know what I mean), so any help is appreciated.
Assuming that your main window has its own NSWindowController
subclass,
how about
- (void)windowDidLoad
Allows subclasses of NSWindowController to perform any required tasks
after the window owned by the receiver has been loaded. The default
implementation does nothing.
(this is from Apple's NSWindowController documentation)?
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)?
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!
_______________________________________________
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.