• 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
Re: Undo after deletion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Undo after deletion (From: Lorenzo <email@hidden>)

  • Prev by Date: Re: NSMatrix: does it have an delegate method...
  • Next by Date: Re: Validity of a path
  • Previous by thread: Undo after deletion
  • Next by thread: Assigning Binary Data From Network To Variables
  • Index(es):
    • Date
    • Thread