Temporarily disabling Undo Registration with Core Data
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