Re: Reloading a window from NIB
Re: Reloading a window from NIB
- Subject: Re: Reloading a window from NIB
- From: Sergey Shapovalov <email@hidden>
- Date: Mon, 12 Mar 2007 10:30:23 +0300
Hello Matt!
Thank you very much for your reply.
To implement this behavior of the "New" command, I'd like to be able
to reload the window in its original state as it is stored in the
NIB. My
question is as simple as: how can I do it?
Two obvious ways:
(1) When the user says to restore the original state of the window,
you just
restore it, in code. You presumably know what the original state
is, and
you're not allowing the user to change the original state, so this
should be
trivial. Just tell all the things in the window what their state
should be.
Yes, that was the first thing that came to my mind. However, it looks
like in my case it's not that simple. Too many parameters to restore:
window position and size, state of all splitters, views and controls.
Besides, some of controls in my window are created dynamically
on the fly, and I don't want to see them after I say "New" - I want to
revert to the original state. That all made me think about reloading
the window from NIB.
Or....
(2) Use a secondary nib containing the window, and "release when
closed".
Load the nib to obtain the window. When the window closes, the
window is
released. Load the nib again to obtain a fresh copy of the window.
You might
find communication between nibs easier if you use an
NSWindowController for
this. In that case, implement singleton on the NSWindowController and
release it when the window closes. m.
Yes, that's what I was planning to do. My question was: how can this
be done? Sorry if I'm asking trivial questions, I don't have much
experience
with Cocoa. A short sample demonstrating how to load a window from
NIB would help me much!
Best regards,
Sergey.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden