NSController & undo handling
NSController & undo handling
- Subject: NSController & undo handling
- From: Raphael Sebbe <email@hidden>
- Date: Tue, 28 Oct 2003 10:30:38 +0100
Hi there,
I am currently discovering NSController stuff and saw the message from
Aaron. I'd like to know what the limitations are regarding undo.
I understand that NSController should decrease the number of lines of
code, but my understanding it is for controller stuff, not model (even
if it can provide default accessors for you). In the particular case of
undo handling (what I am interested in), could you comment on this ?
Thanks,
Raphael
@implementation Converter
+ (void)initialize {
[Converter setKeys:
[NSArray arrayWithObjects:@"dollarsToConvert", @"exchangeRate",
nil]
triggerChangeNotificationsForDependentKey:@"amountInOtherCurrency"];
}
- (NSUndoManager*)undoManager
{
return [document undoManager];
}
- (double)amountInOtherCurrency
{
return (double)(dollarsToConvert * exchangeRate);
}
- (void)setDollarsToConvert:(double)d
{
[[[self undoManager] prepareWithInvocationTarget:self]
setDollarsToConvert:dollarsToConvert];
dollarsToConvert = d;
}
- (void)setExchangeRate:(double)d
{
[[[self undoManager] prepareWithInvocationTarget:self]
setExchangeRate:exchangeRate];
exchangeRate = d;
}
@end
_______________________________________________
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.