Re: Programmatically Clear Dirty NSDocument

2016-11-07 Thread Richard Charles
> On Nov 7, 2016, at 2:33 PM, Quincey Morris > wrote: > > On Nov 7, 2016, at 10:46 , Richard Charles wrote: >> >> This is exactly the same as before but it now works! > > Regarding that particular mystery, NSChangeUndone decrements

Re: Programmatically Clear Dirty NSDocument

2016-11-07 Thread Richard Charles
> On Nov 7, 2016, at 12:24 PM, Jens Alfke wrote: > >> On Nov 7, 2016, at 10:46 AM, Richard Charles wrote: >> >>[doc performSelector:@selector(updateChangeCount:) >> withObject:@(NSChangeUndone) >> afterDelay:0]; > >

Re: Programmatically Clear Dirty NSDocument

2016-11-07 Thread Quincey Morris
On Nov 7, 2016, at 10:46 , Richard Charles wrote: > > This is exactly the same as before but it now works! Regarding that particular mystery, NSChangeUndone decrements the change count. If it happened to be 1 when you tried this, the document would stop being dirty.

Re: Programmatically Clear Dirty NSDocument

2016-11-07 Thread Jens Alfke
Why not just call [doc revertToContentsOfURL:[doc url] ofType:[doc fileType] error:], which is what the docs for -revertDocumentToSaved: say it does after the user confirmation? —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: Programmatically Clear Dirty NSDocument

2016-11-07 Thread Jonathan Mitchell
> On 7 Nov 2016, at 18:46, Richard Charles wrote: > > NSChangeUndone try NSChangeCleared ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Re: Programmatically Clear Dirty NSDocument

2016-11-07 Thread Jens Alfke
> On Nov 7, 2016, at 10:46 AM, Richard Charles wrote: > >[doc performSelector:@selector(updateChangeCount:) > withObject:@(NSChangeUndone) > afterDelay:0]; That one definitely won’t work. The parameter to updateChangeCount: is an integer

Programmatically Clear Dirty NSDocument

2016-11-07 Thread Richard Charles
I have a dirty document that needs to be cleared programmatically. So I try the following but it does not work. I have verified that updateChangeCount: is being called but the document change count state is not being changed. This code is executed on the main thread. // Called from a