Re: Very simple Cocoa question
Re: Very simple Cocoa question
- Subject: Re: Very simple Cocoa question
- From: Brendan Younger <email@hidden>
- Date: Tue, 3 Jul 2001 01:34:48 -0500
Doug Wrote:
Hello everyone! I'm new to this list. I'm trying to figure out how to
make
my application make it so a certain window does not appear in the windows
menu when I open it. I noticed that to do this I need to send the
message:
setExcludedFromWindowsMenu:YES to the window. I know how to send the
message, but I don't know when to send the message. I tried putting it
in my
main function but the window was undefined. This is a very simple
question,
but I don't understand for the life of me how to set it up. Do I have to
set
up connections and my own class and instances in Interface Builder for
this?
There are a few options for this. The best way is probably to have a
single instance of your main, controller class in the main nib file and
connect it to the "delegate" outlet in "File's Owner" which is by
default set to NSApplication. Then, implement
-applicationDidFinishLaunching in you controller class and it will be
called by NSApplication once it finishes launching the app.
For future reference, these are the functions most useful in doing
intialization work once a .nib file has been loaded.
(The following are delegate methods of NSApplication and are good when
dealing with the main nib)
-applicationDidFinishLaunching
-applicationWillFinishLaunching
(The following are called for each class stored in a nib file once the
nib has loaded)
-awakeFromNib
-init <--- this is called for custom classes
-initWithCoder <---whereas this is called for view/predefined classes
such as NSTableView, etc.
I don't know if this list is exhaustive, but its what I've culled from
my limited experience. I had a lot of trouble with this stuff too when
I was learning, does anyone know of good documentation on the in's and
out's of this stuff? I know it's all documented somewhere but I usually
find it buried on page 197 or so of some large .pdf file.
Brendan Younger