• 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 in tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undo in tables


  • Subject: Re: Undo in tables
  • From: Alex Rice <email@hidden>
  • Date: Thu, 11 Apr 2002 20:54:42 -0600

On Thursday, April 11, 2002, at 08:05 PM, Alex Rice wrote:

// use key-value coding to prep the undo manager with the object's current state
[[[self undoManager] prepareWithInvocationTarget:target]
takeValue:[target valueForKey:ident]
forKey:ident];


Eeps. I was getting carried away. The above code doesn't work. It seems as if the forwardInvocation: doesn't like NSKeyValueCoding?

This is another way which definitely works. Scan for the ident string and call the undo registration directly:

if([ident isEqualToString: @"name"])
{
[[self undoManager] setActionName:
NSLocalizedString(@"Edit The Name", nil)];

[[self undoManager] registerUndoWithTarget:target
selector:@selector(setName:)
object:[target name]];
}


// and use key-value coding to set the newvalue
[target takeValue:anObject forKey:ident];
}


Alex Rice, Software Developer
Architectural Research Consultants, Inc.
email@hidden
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Undo in tables (From: Alex Rice <email@hidden>)

  • Prev by Date: Flash Player
  • Next by Date: Strange Crash
  • Previous by thread: Re: Undo in tables
  • Next by thread: Re: Undo in tables
  • Index(es):
    • Date
    • Thread