Re: Right way to load initial data in controls when opening a window
Re: Right way to load initial data in controls when opening a window
- Subject: Re: Right way to load initial data in controls when opening a window
- From: Steve Woodward <email@hidden>
- Date: Thu, 3 Apr 2003 07:12:21 -0500
On Wednesday, April 2, 2003, at 06:47 PM, Jan Van Tol wrote:
On Wednesday, April 2, 2003, at 05:42 PM, Steve Woodward wrote:
On Wednesday, April 2, 2003, at 02:24 PM, Jan Van Tol wrote:
On Wednesday, April 2, 2003, at 06:42 AM, Steve Woodward wrote:
That works great except for the first time the window is opened...I
guess I could use awakeFromNib for the initial opening of the
window, except for one glitch: I am passing a value (a dictionary)
to the window controller and using key-value pairs to load the edit
fields. Since the edit fields aren't available yet during
awakeFromNib I can't load them up yet. I seem to need something
like "afterBeingAwakenFromNib"?
Perhaps a broad overview of what I am trying to do is in order: I
have a window with a table view loaded up with data. I want to have
the user be able to double click that table and have a new window
open with the data from the selected row loaded up in edit fields.
Using Jan's suggestion I have it working except for the initial
opening of the window.
Many thanks for the tips and for any other advice!
Why can't you use awakeFromNib? I think awakeFromNib is supposed to
be called when all the outlets are set up, and ready to be sent
messages. So it should be the perfect place to do and initial date
entry.
awakeFromNib works great...the first time the window loads it does
what it's supposed to. But when I open the window a second time,
since I am not awaking from nib, the window initially displays the
old values in the edit fields. Since the second time the window is
shown it is not being awaken from the nib I'm not suprised. It seems
like I need to duplicate the data loading functionality in two
places...awakeFromNib for the first opening of the window, then
something else (showWindow?) for any subsequent openings. Right now
I'm thinking about having the window destroyed each time, so each
time it's called upon it has to be awaken from the nib, but that
doesn't sound optimal.
Thank you for all your efforts in my behalf!
Instead of duplicating the functionality, put it in a separate method,
say initUI, or some such thing. Then just call that from awakeFromNib
and showWindow.
-Jan Van Tol
Ok, that's exactly what I did last night, and now it works except for
the first loading. I know what the problem is, I don't have the
dictionary passed to the second window controller yet, it seems to me
that once I fine tune the passing of the data I'll be home free. That
brings me back to another thread I had started...windowcontroller
creates an instance of windowcontroller2...have to get a dictionary
into windowcontroller2 so that it's available before awakeFromNib is
called. Not sure how windowcontroller2 references
windowcontroller1..I've gotten a few replies on that thread and am
hoping to piece it all together today.
Many, many thanks for the help!
Steve W
_______________________________________________
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.