Re: multiple window per document problems
Re: multiple window per document problems
- Subject: Re: multiple window per document problems
- From: m <email@hidden>
- Date: Sun, 6 Jun 2004 12:35:19 -0700
- Resent-date: Sun, 6 Jun 2004 13:28:05 -0700
- Resent-from: m <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: Cocoa Dev <email@hidden>
On Jun 6, 2004, at 4:18 AM, mmalcolm crawford wrote:
On Jun 6, 2004, at 4:04 AM, m wrote:
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:
"NSDocument subclasses must also create their window controllers. They
can do this indirectly or directly. If a document has only one nib
file (with one window in it), the subclass can override windowNibName
to return the name of the window nib file; as a consequence, a default
NSWindowController instance is created for the document, with the
document as the nib files owner. If a document has multiple windows,
or if an instance of a custom NSWindowController subclass is to be
used, the NSDocument subclass must override makeWindowControllers to
create these objects."
First try managing all the window controllers through
'makeWindowControllers'.
Yeah, same result: the doc still stays open when all windows are
closed. Explicitly setting setShouldCloseDocument to YES closes the
document when the window is closed, but the other windows do not close
with the document.
Here's my makeWindowControllers code. I also tried calling [super
makeWindowControllers] to make the "main" controller.
- (void)makeWindowControllers
{
NSWindowController* aWindowController;
aWindowController = [[NSWindowController
alloc]initWithWindowNibName:[self windowNibName] owner:self];
[self addWindowController:aWindowController];
[aWindowController setShouldCloseDocument:YES];
aWindowController = [[NSWindowController
alloc]initWithWindowNibName:@"Subwindow" owner:self];
[self addWindowController:aWindowController];
[aWindowController setShouldCloseDocument:NO];
aWindowController = [[NSWindowController
alloc]initWithWindowNibName:@"Subwindow" owner:self];
[self addWindowController:aWindowController];
[aWindowController setShouldCloseDocument:NO];
}
Am I right in thinking this should all "just work"?
_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.