• 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
Popping the undo stack
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Popping the undo stack


  • Subject: Popping the undo stack
  • From: Bill Cheeseman <email@hidden>
  • Date: Thu, 25 Apr 2002 09:50:59 -0400

Is there any way to pop an undo action off the top of the undo stack?

I know I can call undo, but that moves the undo action to the redo stack. I
want to get rid of the undo action completely and permanently.

I need to do this because in some circumstances my undo action is a no-op.
The user experience would be improved if the undo action didn't appear as an
undo menu item when it's a no-op. Because it's a no-op anyway, popping it
won't de-synchronize the undo stack and the user interface.

I don't have the option of simply not registering the undo action when it's
a no-op, because I need the act of registering the undo action for its side
effect of clearing other items from the redo stack.

I can't use removeAllActionsWithTarget: because there are other undo actions
targeting the same object. Besides, this method doesn't work right (it
doesn't remove empty undo groups, as discussed here recently).

The only other option I can think of is to access the private _undoStack
array in the undo manager directly, but I hate to rely on private variables.
In case I decide to do it anyway, can anybody tell me if popping it will
have the effect of removing the menu item, too? -- from past experience, I
believe this will happen automatically if I make sure I pop (or close) the
undo group containing the no-op undo action.

Any ideas?

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont - http://members.valley.net/croquetvermont
_______________________________________________
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.

  • Prev by Date: Re: Inches, Centimeters, and NSMeasurementUnit
  • Next by Date: Re: NSTextView and First Responder
  • Previous by thread: Re: Inches, Centimeters, and NSMeasurementUnit
  • Next by thread: Wait / Busy Cursor
  • Index(es):
    • Date
    • Thread