FROM : Carrie Brezine
DATE : Tue Dec 31 22:16:11 2002
>> After many false steps I've figured out that -awakeFromNib
>> comes after -windowDidLoad, but I don't know how many other things
>> there might be before/after/inbetween those two
>
> I know this is going to sound unhelpful and glib, but my advice
> genuinely is that if you think you need to know this you're doing
> something wrong.
that doesn't surprise me... thank you for your help.
<snip>
> One thing that might be helpful to know, and that is NOT as well
> documented as it might be, is that telling an NSWindowController to
> initWithWindowNibName does not actually load the window. Nothing
> happens until you *refer* to the window. Thus, if you're in doubt, you
> can simply have a routine start with this line:
>
> [self window];
>
> This does nothing except to make darned certain that the window is
> loaded before proceeding. So for example my -awakeFromNib in an
> NSWindowController that is itself instantiated in a nib often starts
> with this line. m.
hooray, I think this was a crucial piece of info I was looking for!
more about what I was trying to do:
I have a login window which validates name & password and if successful
opens another window. This window2 has two views which are loaded into
it from separate nib files. (the reason for this is that each view is
getting something from a db, and will be reused on yet other
windows--my idea was to write the views and their controllers,
including db queries etc, once to avoid putting that code in many
different places). Two problems I've run into so far, which might be
related, at very least through my ignorance of how these windows are
working:
--when loading the views into window2, I'd like to use an instance
variable from Window2controller as a parameter in my db query to
display information in the view. Currently the views are getting
loaded in Window2Controller's -windowDidLoad method, and when the view
initiation goes to try to get a variable from Window2Controller, the
var is always null. Am I correct in thinking that if I move the view
loading to Window2Controller's -awakeFromNib I'll be able to get a real
live variable value?
--I want the login name and password to be available throughout the
program. I thought that if the login window had a controller, I should
be able to set the name and password as variables in
LoginWindowController and then access them by calls such as
[[LoginWindowController sharedLoginWindowController] name];
assuming the proper methods exist. So far no luck-- the vars come back
null. At first I thought this was because I did a [window close] on
the login window, but then I switched that to an -orderOut and it's
still not doing what I intend....
thanks for all the suggestions I've gotten so far, any further help
much appreciated. Happy New Year everyone
carrie
>
> matt neuburg, phd = <email_removed>, http://www.tidbits.com/matt
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Tue Dec 31 22:16:11 2002
>> After many false steps I've figured out that -awakeFromNib
>> comes after -windowDidLoad, but I don't know how many other things
>> there might be before/after/inbetween those two
>
> I know this is going to sound unhelpful and glib, but my advice
> genuinely is that if you think you need to know this you're doing
> something wrong.
that doesn't surprise me... thank you for your help.
<snip>
> One thing that might be helpful to know, and that is NOT as well
> documented as it might be, is that telling an NSWindowController to
> initWithWindowNibName does not actually load the window. Nothing
> happens until you *refer* to the window. Thus, if you're in doubt, you
> can simply have a routine start with this line:
>
> [self window];
>
> This does nothing except to make darned certain that the window is
> loaded before proceeding. So for example my -awakeFromNib in an
> NSWindowController that is itself instantiated in a nib often starts
> with this line. m.
hooray, I think this was a crucial piece of info I was looking for!
more about what I was trying to do:
I have a login window which validates name & password and if successful
opens another window. This window2 has two views which are loaded into
it from separate nib files. (the reason for this is that each view is
getting something from a db, and will be reused on yet other
windows--my idea was to write the views and their controllers,
including db queries etc, once to avoid putting that code in many
different places). Two problems I've run into so far, which might be
related, at very least through my ignorance of how these windows are
working:
--when loading the views into window2, I'd like to use an instance
variable from Window2controller as a parameter in my db query to
display information in the view. Currently the views are getting
loaded in Window2Controller's -windowDidLoad method, and when the view
initiation goes to try to get a variable from Window2Controller, the
var is always null. Am I correct in thinking that if I move the view
loading to Window2Controller's -awakeFromNib I'll be able to get a real
live variable value?
--I want the login name and password to be available throughout the
program. I thought that if the login window had a controller, I should
be able to set the name and password as variables in
LoginWindowController and then access them by calls such as
[[LoginWindowController sharedLoginWindowController] name];
assuming the proper methods exist. So far no luck-- the vars come back
null. At first I thought this was because I did a [window close] on
the login window, but then I switched that to an -orderOut and it's
still not doing what I intend....
thanks for all the suggestions I've gotten so far, any further help
much appreciated. Happy New Year everyone
carrie
>
> matt neuburg, phd = <email_removed>, http://www.tidbits.com/matt
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Carrie Brezine | Dec 30, 21:41 | |
| Michael Latta | Dec 30, 22:09 | |
| matt neuburg | Dec 31, 03:19 | |
| Carrie Brezine | Dec 31, 22:16 | |
| matt neuburg | Jan 2, 02:06 | |
| James DiPalma | Jan 5, 02:21 |






Cocoa mail archive

