Enabling undo in a CoreData app?
Enabling undo in a CoreData app?
- Subject: Enabling undo in a CoreData app?
- From: email@hidden
- Date: Sat, 29 Apr 2006 13:05:33 -0700
I have a CoreData app, and I don't want the user to be able to undo
almost all actions. So, during my -applicationDidFinishLaunching
method, I disableUndoRegistration on my managedObjectContext.
Now, I want to add undo/redo in a couple specific situations. During
one method, I am calling this:
NSUndoManager *undoManager = [[self managedObjectContext]
undoManager];
[undoManager enableUndoRegistration];
[[undoManager prepareWithInvocationTarget:self]
addObjects:validRemovals toCollection:collection];
(If I am not isUndoing, I call -setActionName: here with some
appropriate text)
[undoManager disableUndoRegistration];
And during the -addObjects method, I am calling the compliment:
NSUndoManager *undoManager = [[self managedObjectContext]
undoManager];
[undoManager enableUndoRegistration];
[[undoManager prepareWithInvocationTarget:self]
removeObjects:validAdditions fromCollection:collection];
(If I am not isUndoing, I call -setActionName: here with some
appropriate text)
[undoManager disableUndoRegistration];
However, my "Undo" menu item never becomes enabled. Am I being too
picky about when I am enabling and disabling registration? (I briefly
tried leaving undo registration turned on throughout the application,
but the Undo menu item still never became available.)
Any thoughts for how to track down the problem are appreciated.
Thanks,
Blake
_______________________________________________
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