On Jul 2, 2012, at 2:35 AM, Conrad Shultz <[email protected]> wrote:

> - (void)addRecord:(id)sender
> {
>    if (! [[self undoManager] isUndoing]) {
>        [[self undoManager] setActionName:NSLocalizedString(@"Add Record", 
> nil)];
>    }
>    [[self arrayController] add:sender];
> }

IIRC, you need to put the call to -setActionName: *after* the action that opens 
the undo group. Which I don't see you doing here, but I suppose you're relying 
on it happening as a side effect of whatever the array controller does?

This is because NSUndoManager is a very old class with a very weird internal 
data structure that can't attach an action name without an object at the top of 
its stack. You might investigate using Graham Cox's GCUndoManager.

FWIW, we put all our undo actions in the model because of AppleScript, but that 
makes our model single-threaded.

--Kyle Sluder
_______________________________________________

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