Binding and dependant keys
Binding and dependant keys
- Subject: Binding and dependant keys
- From: Frédéric Testuz <email@hidden>
- Date: Sat, 13 Nov 2004 11:58:25 +0100
Hello,
In an app, I have a Person class
@interface Person : NSObject
{
NSString *firstName;
NSString *lastName;
}
@end;
I have defined the accessor methods. I also defined
+ (void)initialize
{
[self setKeys:[NSArray arrayWithObjects:@"firstName", @"lastName", nil]
triggerChangeNotificationsForDependentKey:@"fullName"];
}
- (NSString *)fullName
{
return [lastName stringByAppendingFormat:@", ", firstName];
}
I have a window with a NSTableView which display the fullName key and
two NSTextField to edit firstName and lastName. There is also a button
connect to the insert: action of the NSArrayController.
When the window is display, the fullName of all the record is display
correctly. But when I push the button to insert a new record, the
fullName method is never called for this new record. So the change is
never reflect in the table view for this new record only.
Any idea why ? And how I can resolve this ?
--
Frédéric Testuz
<mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden