Documents with multiple windows
Documents with multiple windows
- Subject: Documents with multiple windows
- From: Nicola Vitacolonna <email@hidden>
- Date: Mon, 15 Apr 2002 14:27:59 +0200
I have a document with two windows displaying the same data (in
NSDocument) in different ways.
My project contains three nib files, MainMenu.nib, MyMainWindow.nib,
MyAuxiliaryWindow.nib, and two window controllers, one for each window.
So far, pretty common.
My question is: whenever a document is opened, I want the main window to
be shown, while the auxiliary window should appear only when the user
selects the corresponding menu item. What do you think is the best way
(or one good way) to implement this behaviour?
I read Apple's docs and the archive but still have some doubt about my
way of doing things:
1) I opened MainMenu.nib in IB and I added a "showAuxiliaryWindow:"
action to the FirstResponder, then connected the menu item to this
action.
2) I implemented showAuxiliaryWindow: in MyMainWindowController.m. This
method calls a "showAuxiliaryWindow" method in MyDocument.m, which in
turn should instantiate and add a MyAuxiliaryWindowController class.
3) In MyDocument, I implemented makeWindowControllers creating and
adding only MyMainWindowController.
4/ To make the auxiliary window appear, I added a [[self window]
showWindow:self] message in the init method of
MyAuxiliaryWindowController, after the message [super
initWithWindowNibName:@"MyAuxiliaryWindow"].
5) I assume that MyAuxiliaryWindowController is detached and released
when the window is closed, so I don't have to do anything.
Is all that right? In particular, is that the way of connecting menu
items? Would it better to create all window controllers in
makeWindowControllers?
Thanks in advance!
Nicola
** ** Get my PGP public key at:
** * ** * www.dimi.uniud.it/~vitacolo
** * ** * or finger email@hidden
** * Universita' degli Studi di Udine
* ***icola Vitacolonna
_______________________________________________
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.