multiple windowcontrollers
multiple windowcontrollers
- Subject: multiple windowcontrollers
- From: Koen van der Drift <email@hidden>
- Date: Wed, 23 Jun 2004 21:49:40 -0400
Hi,
I have a document based app with a main window and another window that
displays some info on the contents of the main window. I might even
add a third window used as a 'search window'.
Is it correct to add more than one wndowControllers in MyDocument:
-(void)makeWindowControllers
{
IDMainWindowController *controller = [[IDMainWindowController
allocWithZone:[self zone]] init];
IDSecondWindowController *secondController =
[[IDSecondWindowController allocWithZone:[self zone]] init];
[self addWindowController:controller];
[self addWindowController:secondController];
[controller release];
[secondController release];
}
I looked at several tutorials on the web, but none of them seem to use
this approach (create more than one windowcontroller), although the
method name indicates plural. So is my approach above correct?
I don't want the 2ndWindow to open immediately, but only after the user
selects a menu item. So to open the window I added a menu item in
MainMenu.nib, and connected that to an instance of MyAppController,
which in turn calls:
-(IBAction)show2ndWindow:(id)sender
{
[secondController showWindow:self];
}
That of course only works if MyAppController knows about 2ndcontroller
from MyDocument, but how do I make that connection. Maybe something
like:
[[NSApp mainWindow] secondController] ?
Probably related to the above is, how do I make sure that the 2nd
window uses the data from the front window if there are more than one
documents open?
thanks,
- Koen.
_______________________________________________
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.