• 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
Re: multiple windowcontrollers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple windowcontrollers


  • Subject: Re: multiple windowcontrollers
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Thu, 24 Jun 2004 00:23:06 -0700

Hello...

It sounds like you really don't want to have each document use more than one window controller...

Since you seem to want one info window per application as opposed to one per document, the info window controller (and the search window controller if/when you implement it) should really belong to the main application controller.

In that case, the info and search controllers would probably be instance variables in in your MyAppController class, and you will be able to access them directly like you had wanted.

-(IBAction)show2ndWindow:(id)sender
{
[secondController showWindow:self];
}

You will probably also want to make sure that the info window and search window are actually NSPanel instances, since they will be serving that type of purpose (and so they can't become the main window).


In regard to making sure that the info window always displays information about the current (frontmost) document when there are multiple documents open, NSDocumentController provides the currentDocument method which will return the NSDocument instance associated with the main window.

You could register as an observer for the NSWindowDidBecomeMainNotification sent out when the main window changes, and refresh your info window if the document has changed.


Hope that helps,

Louis


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'.

...
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:
...
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.
_______________________________________________
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: Koen van der Drift <email@hidden>
References: 
 >multiple windowcontrollers (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: Quartz and QuickTime Movies... ?
  • Next by Date: Re: Forcing NSSplitView to constrain position?
  • Previous by thread: multiple windowcontrollers
  • Next by thread: Re: multiple windowcontrollers
  • Index(es):
    • Date
    • Thread