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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to