• 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 window per document problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

multiple window per document problems


  • Subject: multiple window per document problems
  • From: m <email@hidden>
  • Date: Sun, 6 Jun 2004 04:04:09 -0700

I'm running into a bit more trouble than I expected trying to implement a multiple window per document app.

I have a "main" window for my document and several secondary windows. The main window is created and managed as usual (it comes from the documents nib file). The secondary windows are handled in a method of my NSDocument subclass like this:

NSWindowController* aWindowController = [[NSWindowController alloc]initWithWindowNibName:@"Subwindow" owner:self];
[self addWindowController:aWindowController];
[aWindowController showWindow:self];

First problem: The documented default behavior for a document with multiple windows is that the document remains open until the user closes the last window. <http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/Classes/NSWindowController.html#// apple_ref/doc/uid/20000031/BAJDBCHC>

But this is not what I'm seeing. I can close all the windows and the document stays open.

I worked around this problem thusly:

[mainWindowController setShouldCloseDocument:YES];

This gives me the behavior I'm after (closing the main window closes the doc, closing a secondary window does not) but I'm uneasy. It doesn't seem right that I should have to do this as it is in conflict with the docs.

Second problem:

Closing the main window closes the document, but the secondary windows remain open. This also seems wrong as I expected to get the proper behavior "for free".

Either my expectations need adjustment or I am doing something wrong. I suspect the latter.

Any help appreciated.

_murat
_______________________________________________
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 window per document problems
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: More on NSTask and output to NSTextView
  • Next by Date: Re: multiple window per document problems
  • Previous by thread: Re: NSAttributedString and bindings
  • Next by thread: Re: multiple window per document problems
  • Index(es):
    • Date
    • Thread