Undo after deletion
Undo after deletion
- Subject: Undo after deletion
- From: Lorenzo <email@hidden>
- Date: Sat, 05 Jan 2008 05:13:23 +0100
Hi, I am implementing the undo functions.
I followed the sample on the docs so I did
- (void)SetOn:(BOOL)flag
{
[[gUndoManager prepareWithInvocationTarget:self] SetOn:mOn];
[gUndoManager setActionName:@"Set On"];
mOn = flag;
}
This works very well with undo and redo until I delete the object "self".
In facts when I delete the object and call "Undo Delete Object", I create a
brand new object using a dictionary with the old object's values. Of course
the new object has a different pointer, so if I call now "Undo Set On" I get
a crash. How can I fix this trouble?
To avoid this trouble actually I use a complex method which stores into the
undo record the "index" of the object in the object list. So for example I
say to undo the 4th object in the list. But I am not sure this method is
safe and clear. Have you a better idea?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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