• 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 didCloseAllSelector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocumentController didCloseAllSelector


  • Subject: Re: NSDocumentController didCloseAllSelector
  • From: Graham Cox <email@hidden>
  • Date: Thu, 1 Oct 2009 11:42:05 +1000


On 01/10/2009, at 11:00 AM, Chris Idou wrote:

The doco for closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo: says that it should call
the didCloseAllSelector. How would one do that? This is what I am doing:

Chris, this stuff is a right old mess. No wonder you're confused.

It says *it* will call that method if all documents are closed. You don't necessarily have to call anything - looking at the byzantine interactions between all these methods all I can say is, if you can avoid it, do so!

What do you want to do? Unless you're overriding - (void) canCloseDocumentWithDelegate:(id)delegate shouldCloseSelector:(SEL) shouldCloseSelector contextInfo:(void *)contextInfo
to do something in a non-standard way there's nothing to do. If you are overriding it, you need to handle the whole kit-n-kaboodle, including presenting the alert to the user and saving the document to disk, and finally invoking the mysterious callback selector.


I can't actually see an easy way to invoke the callback selector with the signature as given - you need to pass it the document (self), a BOOL and the contextInfo. You can invoke the method directly on the delegate easily enough, but since you're supposed to use the callback supplied, that might not work. The only way I can see to do it is to create an NSInvocation with the selector, set each argument and call invokeWithTarget: passing the delegate.

Someone else might have a brighter idea - this seems very involved and badly thought-out.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSDocumentController didCloseAllSelector
      • From: Chris Idou <email@hidden>
    • Re: NSDocumentController didCloseAllSelector
      • From: "Adam R. Maxwell" <email@hidden>
References: 
 >NSDocumentController didCloseAllSelector (From: Chris Idou <email@hidden>)

  • Prev by Date: Re: NSWindowController and GC
  • Next by Date: Re: NSLayoutManager and best override point for temporary attributes
  • Previous by thread: NSDocumentController didCloseAllSelector
  • Next by thread: Re: NSDocumentController didCloseAllSelector
  • Index(es):
    • Date
    • Thread