OK, I think you're endorsing what I was planning. I have (among other actions) two that are inverses of each other, add and remove. Currently the add routine creates an action called Add, and registers the remove routine as its undo action. The remove routine creates an action called Remove, and register the add routine as its undo action. This leads to the redo of add appearing as Undo Remove, and that's my problem.

So there are two approaches I can see. One is to refactor the add and remove routines into two levels, one of which does the creation of an undo element, and the other actually doing the work. The other is to check whether we're undoing and not set the name in that case. At present I'm leaning towards the latter.

John
Quincey Morris <mailto:[email protected]>
21 December 2016 at 10:44
On Dec 21, 2016, at 00:06 , John Brownie <[email protected] <mailto:[email protected]>> wrote:

No, there are three steps: create, undo, redo. You only set the name on the create step. So, after you do the add, the menu reads “Undo Add”. After you undo the add, the menu reads “Redo Add”. After you redo the add, the menu reads “Undo Add” again.

(IIRC, if you code is structured in such a way that you want to handle multiple steps in one place, you can test the “isUndoing” and “isRedoing” properties to decide whether to set the name.)


--
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