• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Temporarily disabling Undo Registration with Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Temporarily disabling Undo Registration with Core Data


  • Subject: Temporarily disabling Undo Registration with Core Data
  • From: Justin Hawkwood <email@hidden>
  • Date: Wed, 25 May 2005 14:05:06 -0700

I have a Core-Data Document app that I am trying to have instantiate an object when opening a new document. I have gotten this part to work by checking for this objects existence during awakeFromNib by using executeFetchRequest; If the object does not exists, then I create one using insertNewObjectForEntityForName. This works fine with the exception that it dirties the document, and can be "Undo"ne. I have tried various combinations of the following:

- (void)awakeFromNib
{
... (some code) ...
[[[self managedObjectContext] undoManager] disableUndoRegistration];
[NSEntityDescription insertNewObjectForEntityForName:@"obj"
inManagedObjectContext:[self managedObjectContext]];
[[[self managedObjectContext] undoManager] enableUndoRegistration];
[[[self managedObjectContext] undoManager] removeAllActions];
}


If I only disableUndoRegistration, then nothing is ever "Undo"able, but if I do both disableUndoRegistration and enableUndoRegistration (or use removeAllActions), then the first new document shows up as clean until I click on the window, anywhere, then it dirties and is "Undo"able, all additional documents are dirty immediately.

How do I disable (or clear) the undoManager for this one function?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Temporarily disabling Undo Registration with Core Data
      • From: John Timmer <email@hidden>
    • Re: Temporarily disabling Undo Registration with Core Data
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: NSTextStorage subclassing issue in 10.4
  • Next by Date: Re: Odd WebView Bhaviour
  • Previous by thread: Re: Odd WebView Bhaviour
  • Next by thread: Re: Temporarily disabling Undo Registration with Core Data
  • Index(es):
    • Date
    • Thread