Re: Override runModalSavePanelForSaveOperation
Re: Override runModalSavePanelForSaveOperation
- Subject: Re: Override runModalSavePanelForSaveOperation
- From: Quincey Morris <email@hidden>
- Date: Wed, 16 Jan 2013 14:05:16 -0800
On Jan 16, 2013, at 13:36 , Eric Gorr <email@hidden> wrote:
> I need to override runModalSavePanelForSaveOperation in NSDocument to provide some custom behavior.
I'd suggest you keep trying to find a way to avoid doing this. Even inconveniences like having to work through an extra dialog before or after the standard save panel might be preferable.
The problem is that the list of things that that the "default implementation" of such methods has changed over time from 10.5-10.8. If you override one and *don't* call super, then your app may inexplicably break in a future OS X.
> According to the description in the documentation, one needs to call saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: which I am doing. However, my writeToURL:ofType:forSaveOperation:originalContentsURL:error: method is not called and I was expecting it to be. If I use the default runModalSavePanelForSaveOperation, it will be.
You use the word "call", but that's not what you're supposed to do -- you need to invoke a NSInvocation. Perhaps what you meant. If not, the process is explained in these old release notes:
https://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKitOlderNotes.html
under this heading:
Advice for Overriders of Methods that Follow the delegate:didSomethingSelector:contextInfo: Pattern
> (I am also wondering how to properly handle the process to "make sure that any editor registered using the Cocoa Bindings NSEditorRegistration informal protocol has committed its changes.")
NSDocument implements this protocol already (though it's not documented as doing so), so you simply need to send one of the 'commit…' methods to self, I suppose. However, without an API contract beyond what you quoted, it's not absolutely clear it's that simple.
_______________________________________________
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