• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
multiple windowcontrollers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: multiple windowcontrollers
      • From: "Louis C. Sacha" <email@hidden>
  • Prev by Date: Re: Best way to implement a calculator style display/input system?
  • Next by Date: Thanks for the help re: Xcode weirdness
  • Previous by thread: Re: Custom IB Palettes with Outlets and Actions
  • Next by thread: Re: multiple windowcontrollers
  • Index(es):
    • Date
    • Thread