Re: Undo in tables
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.