Re: Child windows?
Re: Child windows?
- Subject: Re: Child windows?
- From: Ryan Stevens <email@hidden>
- Date: Wed, 29 Jan 2003 19:44:46 -0800
On Wednesday, January 29, 2003, at 11:23 AM, Matt Gemmell wrote:
On Wednesday, January 29, 2003, at 05:58 pm, James Pengra wrote:
In a document-style application I want to open a window in which
to make an analytical plot of some data. This window will always be
associated with with a main document window. I only want the window
visible when called by the user.
I could create a window with its own Nib file and Controller, but
I discovered the concept of a Child Window, and wonder if that would
be a better approach. I don't find a lot of discussion or use of
Child windows in the books I have, or even in Apple's documentation.
Not entirely sure what you mean by a child window, but If you're
opening a secondary view or alternate representation of the same
document's data/content, you'd probably do so by associating an
additional WindowController (and its window) with the same
DocumentController. I'm sure Aaron's and Scott's (et al) books discuss
the hierarchy of doc-controllers to window controllers to windows.
You'd just have two window controllers, each with its own window,
owned by the same doc controller.
[aWindow setChildWindow: bWindow] = bWindow attached to (/moves* with)
aWindow.
* It doesn't seem to move if the parent window is resized but you can
fix that easily by grabbing the didResize notification or by being the
parent window's delegate and working from there.
Anyway, given that - do you need the child window to move with the
parent?
If not and if it were me, I'd make a subclass of NSWindow w/ a
-auxWindow and -setAuxWindow:. That would let the "parent" close the
child as needed. Or, if it suits the situation better a controller
could deal with that.
If your auxiliary window will most likely be visible through the life
of the document I wouldn't bother with an extra nib. I use an extra nib
for controls/windows less likely to be requested right off the bat or
that aren't used all the time - mostly subjective.
HTH
_______________________________________________
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.