• 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 without Redo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undo without Redo


  • Subject: Re: Undo without Redo
  • From: Greg Titus <email@hidden>
  • Date: Sun, 12 Jul 2009 08:05:42 -0700


On Jul 12, 2009, at 7:10 AM, John Nairn wrote:

I added an option to cancel some action in the middle of the action. The most convenient coding was to implement the cancel by calling undo in the NSUndoManager, but this adds a "Redo" action to redo the partial or incomplete changes (and leaves the data in a poor state).

I can either re-code the change process or for an alternative, is there a way to perform to top level undo without having it moved to the redo stack? Or, similarly, is there a way to perform an undo and then remove the top most item in the redo stack?

First, I'd agree with I.S. that this sounds a little bit unclean, and that if there is a way to rearchitect this, I would.


But to answer your question, the "redo" action consists of all those things that get registered for undo _during_ the time when it is undoing (which is why it is the opposite set of changes from the undone changes). So it ought to work to disable registration during that time. I.e.:

	[undoManager disableUndoRegistration];
	[undoManager undo];
	[undoManager enableUndoRegistration];

Ought to undo the last top level undo group, but without registering anything on the redo stack.

Hope this helps,
	Greg
_______________________________________________

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 without Redo
      • From: Dave Fernandes <email@hidden>
References: 
 >Undo without Redo (From: John Nairn <email@hidden>)

  • Prev by Date: Re: Undo without Redo
  • Next by Date: literal strings - who do they belong to?
  • Previous by thread: Re: Undo without Redo
  • Next by thread: Re: Undo without Redo
  • Index(es):
    • Date
    • Thread