Re: Intercept Save when closing NSDocument

2017-02-12 Thread Mike Abdullah
___ 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: https://lists.apple.co

Re: Intercept Save when closing NSDocument

2017-02-11 Thread Uli Kusterer
On 10 Feb 2017, at 18:23, Jens Alfke wrote: > >> On Feb 10, 2017, at 9:19 AM, Keary Suska wrote: >> >> I would start by overriding -saveDocument: and -saveDocumentAs: in your >> NSDocument subclass with a breakpoint so I can see what is being done. > > Even easier: wait for the save dialog to

Re: Intercept Save when closing NSDocument

2017-02-10 Thread Kevin Perry
NSSavePanelDelegate is probably the approach you want to take, with -[NSDocument prepareSavePanel:] being the most convenient means of inserting your delegate. > On Feb 10, 2017, at 9:41 AM, Quincey Morris > wrote: > > On Feb 10, 2017, at 08:12 , Trygve Inda wrote: >> >> I would like to dis

Re: Intercept Save when closing NSDocument

2017-02-10 Thread Quincey Morris
On Feb 10, 2017, at 08:12 , Trygve Inda wrote: > > I would like to disable the Save button > for a demo version of our app. Have you looked at the NSSavePanelDelegate methods? One approach would be to use panel:validateURL:error: to prevent the save proceeding. Another would be to use (say) pa

Re: Intercept Save when closing NSDocument

2017-02-10 Thread Trygve Inda
On 2/10/17, 9:19 AM, "Keary Suska" wrote: > >> On Feb 10, 2017, at 9:12 AM, Trygve Inda >>wrote: >> >> When I close an NSDocument, it puts up a sheet offering (Don¹t Save, >> Cancel, Save). >> >> Is there a way to intercept this? I would like to disable the Save >>button >> for a demo version

Re: Intercept Save when closing NSDocument

2017-02-10 Thread Jens Alfke
> On Feb 10, 2017, at 9:19 AM, Keary Suska wrote: > > I would start by overriding -saveDocument: and -saveDocumentAs: in your > NSDocument subclass with a breakpoint so I can see what is being done. Even easier: wait for the save dialog to appear, then hit the Pause button in the debugger and

Re: Intercept Save when closing NSDocument

2017-02-10 Thread Keary Suska
> On Feb 10, 2017, at 9:12 AM, Trygve Inda wrote: > > When I close an NSDocument, it puts up a sheet offering (Don¹t Save, > Cancel, Save). > > Is there a way to intercept this? I would like to disable the Save button > for a demo version of our app. I could mark the document as having no > cha

Intercept Save when closing NSDocument

2017-02-10 Thread Trygve Inda
When I close an NSDocument, it puts up a sheet offering (Don¹t Save, Cancel, Save). Is there a way to intercept this? I would like to disable the Save button for a demo version of our app. I could mark the document as having no changes, but then it would just close directly and not allow a cancel