Re: Core Data & Undo Problem
Re: Core Data & Undo Problem
- Subject: Re: Core Data & Undo Problem
- From: "Kevin" <email@hidden>
- Date: Tue, 6 Feb 2007 21:51:48 +0000
- Importance: Normal
- Sensitivity: Normal
Make sure you call [managedObjectContext processPendingChanges] before enabling undo.
Kevin
Sent via BlackBerry from Cingular Wireless
-----Original Message-----
From: Jean-Olivier Lanctôt <email@hidden>
Date: Tue, 6 Feb 2007 16:27:19
To:email@hidden
Subject: Core Data & Undo Problem
Hello,
So I'm trying to disable undo for a specific action (removal of objects)
>
> NSUndoManager *undoMgr = [[self managedObjectContext] undoManager];
>
> [undoMgr disableUndoRegistration]; // Disable it for the time being
> [filesArrayController removeObjects:files];
> [filesArrayController commitEditing];
> [undoMgr enableUndoRegistration]; // Enable it finally
The goal of disabling and then enabling the undo manager for my
context was to make sure the removal of objects in "files" could
not be undone.
But this doesn't work, even if I -commitEditing.
It seems like the NSArrayController is -registerUndoWithTarget
*later* (after the manager has been enabled).
So the problem is -- where/when should I call -enableUndoRegistration
(it should be AFTER the array controller tries registering the action)?
I even tried to enable with a delay (perform selector with delay),
but no luck there.
Thanks for any help.. I'm totally puzzled here.
--Olivier
P.S. It works if I don't ever call -enableUndoRegistration, so this
tells us it's just a matter of knowing when to enable registration.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden