• 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
NSController & undo handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: How to get Mac OS X System preference window from cocoa application
  • Next by Date: Re: How to get Mac OS X System preference window from cocoa application
  • Previous by thread: Re: How to get Mac OS X System preference window from cocoa application
  • Next by thread: vertical text alignment
  • Index(es):
    • Date
    • Thread