Re: Undo after deletion
Re: Undo after deletion
- Subject: Re: Undo after deletion
- From: Keary Suska <email@hidden>
- Date: Sun, 06 Jan 2008 13:54:10 -0700
- Thread-topic: Undo after deletion
on 1/4/08 9:13 PM, email@hidden purportedly said:
> 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?
Implement the "reverse" of the delete object, passing the current object to
the undo manager. E.g.:
[undoManager registerUndoWithTarget:self
selector:@selector(undeleteObject:) object:currentObject];
Depending on your context and implementation, you may have to watch out for
memory issues (your objects will not get released until undone or the undo
action is removed). You may also need to consider redo behavior if you
aren't controlling undo entirely by code.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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