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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to