On Jun 4, 2010, at 13:03, Brad Stone wrote: > How do I create the callback method? I don't understand what the signature > is telling me. I have > canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: in my > NSDocument and I want to set up the callback method. When I create a method > as below it never fires. I must just not be reading it correctly. > > - (void)document:(NSDocument *)doc shouldClose:(BOOL)shouldClose > contextInfo:(void *)contextInfo { > NSLog(@"hey, it finally worked!"); > } > > What exactly should the method be in my NSDocument?
It's a bit confusing, because your 'canCloseDocumentWithDelegate...' is an override. That means a delegate selector is being passed *in* to this method, and it's not your selector. There's no direct way to substitute your 'document:shouldClose:...' method for the supplied one. But there is a solution. Look in the Leopard AppKit Developer Release Note: http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKitOlderNotes.html in the section with the following title: Advice for Overriders of Methods that Follow the delegate:didSomethingSelector:contextInfo: Pattern This explains what you need to do to get your method to be called. _______________________________________________ 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