Re: NSDocumentController's closeAllDocuments... & NSApplication - AHA!!
Re: NSDocumentController's closeAllDocuments... & NSApplication - AHA!!
- Subject: Re: NSDocumentController's closeAllDocuments... & NSApplication - AHA!!
- From: Seth Willits <email@hidden>
- Date: Sat, 15 Oct 2005 13:30:48 -0700
On Oct 15, 2005, at 12:35 PM, Seth Willits wrote:
In -
reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAll
Selector:contextInfo: (which I'm using to display a custom panel)
you're supposed to call NSDocumentController's
closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo:. My
question is, what am I supposed to pass for didCloseAllSelector:?
The delegate is the NSApplication class instance for the app but
there definitely isn't a public method for this, and I can't find a
private one either.
What should I do?
Sweet. I figured it out. For some reason by brain was connecting the
delegate in reviewUnsaved... to the delegate of closeAll... but it is
not so! The delegate of the latter is whatever you wish, so I just
made it the document controller and did:
- (void)
reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSe
lector:contextInfo:
{
...
// Saving documents
[self closeAllDocumentsWithDelegate:self
didCloseAllSelector:@selector
(documentController:didCloseAll:contextInfo:) contextInfo:contextInfo];
objc_msgSend(delegate, didReviewAllSelector, self, NO,
contextInfo);
}
- (void)documentController:(NSDocumentController *)controller
didCloseAll:(BOOL)didCloseAll contextInfo:(void *)contextInfo;
{
if (didCloseAll)
[NSApp terminate:nil];
}
Works great! I think it even fixed this bug I was having with unsaved
documents not being released when quitting... sweeeeeeeetness!
--
Seth Willits
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden