• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Undo after deletion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Undo after deletion
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Window close button issue in Leopard
  • Next by Date: Assigning Binary Data From Network To Variables
  • Previous by thread: Re: NSAppleEventDescriptor & Extracting a Date value
  • Next by thread: Re: Undo after deletion
  • Index(es):
    • Date
    • Thread