• 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: NSDocumentController's closeAllDocuments... & NSApplication - AHA!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSDocumentController's closeAllDocuments... & NSApplication (From: Seth Willits <email@hidden>)

  • Prev by Date: NSDocumentController's closeAllDocuments... & NSApplication
  • Next by Date: table view with non-selectable rows
  • Previous by thread: NSDocumentController's closeAllDocuments... & NSApplication
  • Next by thread: table view with non-selectable rows
  • Index(es):
    • Date
    • Thread