• 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: Undo Names in NSPersistentDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undo Names in NSPersistentDocument


  • Subject: Re: Undo Names in NSPersistentDocument
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 18 Dec 2009 23:25:51 -0800

On 2009 Dec 18, at 21:34, Gerriet M. Denkmann wrote:

> I added in MyDocument.m:
>
> - (IBAction)add: sender;
> {
> 	[ [ self undoManager ] setActionName: @"Add" ];
> 	[ dictWordArrayController add: sender ];
> }
>
> and now got two Undo items:

I presume you mean that you can click Undo once, and then the item is still enabled, so you click again.

> 1. Undo Add (which does nothing)
> 2. Undo (without name, which undoes the add:)

Yes, it's a fairly well-known issue.  Except, you imply that before you added this method, there was only one Undo click available.  That's very interesting -- something I'd never noticed.  It's as though setting the action name is being registered as an undoable action, and gets thrown on the Undo Stack.  So maybe your "does nothing" is actually un-setting the action name ?!?!?

I have a work in progress which solves this problem by beginning an undo grouping whenever a managed object changes, and the same method ends it "automatically" via performSelector:withObject:afterDelay:.  The idea is that it swallows up whatever Core Data does into one super-undo-group.  It works pretty good but I'm still ironing it out.

For another solution, you should read this:

http://wilshipley.com/blog/2007/12/transitions-and-epiphanies.html

_______________________________________________

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

References: 
 >Undo Names in NSPersistentDocument (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Undo Names in NSPersistentDocument (From: Graham Cox <email@hidden>)
 >Re: Undo Names in NSPersistentDocument (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Weird problem closing windows
  • Next by Date: Re: NSAlert or what?
  • Previous by thread: Re: Undo Names in NSPersistentDocument
  • Next by thread: Re: Undo Names in NSPersistentDocument
  • Index(es):
    • Date
    • Thread