• 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: How to use NSUndoManager removeAllActionsForTarget:?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use NSUndoManager removeAllActionsForTarget:?


  • Subject: Re: How to use NSUndoManager removeAllActionsForTarget:?
  • From: Mason Mark <email@hidden>
  • Date: Wed, 17 Apr 2002 02:00:41 -0700

Yes, the problem is removing undo actions does not remove their enclosing group in the undo stack, even when you remove all the actions in a group.

As I understand it, this is a "feature" (i.e., it is the way it is designed to work), but I would also consider it a bug, or at least a pretty unfortunate design flaw. If you remove all the undo actions within a group, it doesn't make much sense that the undo group remains but does nothing when undone or redone.

But rather than NSUndoManager trying to automatically remove the undo groups (and also, like Brian mentions, undo groups below the one being removed), I think the undo API needs to be beefed up a little bit to allow applications to remove arbitrary undo groups in addition to individual undo actions.

I'd file a bug report specifically requesting this enhancement to the API.
(I actually did file a similar request a few months ago.)

--
Mason Mark
Five Speed Software, Inc.

On Monday, April 15, 2002, at 05:16 PM, Brian Webster wrote:

On Monday, April 15, 2002, at 05:59 PM, cocoa-dev-
email@hidden wrote:

Is removeAllActionsWithTarget: failing to remove the group delimiters when
it should? Is this a bug, or am I responsible for getting rid of them (and
if so, how?)?

I'd qualify this as a bug, at least to a certain extent. The way I see it, whenever you remove actions from the undo stack, any grouping from which an action is removed should also be removed, since invoking that group of actions could potentially lead to an inconsistent state. Furthermore, any group below such a group in the stack should also be removed, since there's even more chance to arrive at an inconsistent state if these actions are invoked.

So, I think removeAllActionsWithTarget: really should do this stack cleaning for you, since there's no API to do it yourself, or there should at least be a method that you can call to set this behavior. For now, the two choices seem to be to wipe out the whole stack when an object goes away, or just live with an undo that does nothing. Or of course, you could always do a little hacking to clean it up yourself, but this probably wouldn't be much fun.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: How to use NSUndoManager removeAllActionsForTarget:? (From: Brian Webster <email@hidden>)

  • Prev by Date: NSTextField/NSDateField?
  • Next by Date: Using Carbon in Cocoa App
  • Previous by thread: Re: How to use NSUndoManager removeAllActionsForTarget:?
  • Next by thread: attributed strings and embedded images.
  • Index(es):
    • Date
    • Thread