• 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
Re: NSUndoManager setActionName: oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUndoManager setActionName: oddity


  • Subject: Re: NSUndoManager setActionName: oddity
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 02 Jul 2012 08:25:45 -0700

On Jul 2, 2012, at 2:35 AM, Conrad Shultz <email@hidden> 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@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: NSUndoManager setActionName: oddity
      • From: Conrad Shultz <email@hidden>
References: 
 >NSUndoManager setActionName: oddity (From: Conrad Shultz <email@hidden>)

  • Prev by Date: Re: NSUndoManager setActionName: oddity
  • Next by Date: Re: Base64 encoding of NSImage
  • Previous by thread: Re: NSUndoManager setActionName: oddity
  • Next by thread: Re: NSUndoManager setActionName: oddity
  • Index(es):
    • Date
    • Thread