Skip navigation.
 
mlUndo after deletion
FROM : Lorenzo
DATE : Sat Jan 05 05:13:23 2008

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_removed>

Related mailsAuthorDate
mlUndo after deletion Lorenzo Jan 5, 05:13
mlRe: Undo after deletion Keary Suska Jan 6, 21:54