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 07:29:58 -1000
On Saturday, Sep 28, 2002, at 04:15 Pacific/Honolulu, mw wrote:
>
Hello,
>
>
I am currently in the process of learning cocoa from a book (Cocoa
>
Programming with Mac OS X), and I have branched off from it for a
>
while to
>
create a little "tester" program that basically will test out my
>
skills in
>
cocoa that I have learned thus far. It is pretty much a pointless
>
program
>
that keeps track of money that you owe people (bills, essentially). It
>
uses
>
an NSTableView, and in order to practice with NSDrawers, I turned off
>
direct
>
editing in the table to use a drawer as a properties "window". It also
>
saves/loads from a file.
>
>
Now on to my question. I wanted my own sheet (one loaded from a nib
>
file) in
>
the program, so I figured I'd make one that would come down and let
>
the user
>
know if any bills were overdue, and then when they dismissed the
>
sheet, the
>
overdue bills would be highlighted in the table. I made a new class
>
(subclass of NSWindowController) to control the sheet window, I made
>
all of
>
the connections in IB, etc., etc.
>
>
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)?
_______________________________________________
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.