• 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
Giving names to undo actions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Giving names to undo actions


  • Subject: Giving names to undo actions
  • From: John Brownie <email@hidden>
  • Date: Wed, 21 Dec 2016 10:06:21 +0200

I have undo working correctly in my macOS app, but I have a question about action names.

The documentation tells you to set the name when registering the action on the undo stack. The correct name appears in the Undo menu item. The trouble is when you have symmetric actions, such as add and delete an item. You do an add, which puts the name "add" for the action. Undoing it is a remove, which sets the name "remove". Then you have "Redo remove" as the menu item, which isn't correct.

It seems that the way to get around this is to set the action name only when you are actually doing the original action, and not when doing the undo version of it. Is that a correct interpretation? If so, how do you implement it? Do you test the NSUndoManager's undoing property and only set the name if it is NO?

Any insights welcomed!
John
--
John Brownie
In Finland on furlough from SIL Papua New Guinea
_______________________________________________

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: Giving names to undo actions
      • From: Graham Cox <email@hidden>
    • Re: Giving names to undo actions
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Symbolic breakpoints or category?
  • Next by Date: Re: Giving names to undo actions
  • Previous by thread: Re: Symbolic breakpoints or category?
  • Next by thread: Re: Giving names to undo actions
  • Index(es):
    • Date
    • Thread