Re: tableSelectionDidChange
Re: tableSelectionDidChange
- Subject: Re: tableSelectionDidChange
- From: Darin Duphorne <email@hidden>
- Date: Thu, 30 Aug 2001 15:45:55 -0500
Thanks for the help - I'm still having difficulty:
Data is stored in array (records) of MutableDictionary (record) like so:
<plist version="0.9">
<array>
<dict>
<key>Email</key>
<string>email@hidden</string>
<key>First Name</key>
<string>tester</string>
<key>Home Phone</key>
<string>123-1234</string>
<key>Last Name</key>
<string>dude</string>
</dict>
</array>
</plist>
- (void)awakeFromNib
.
.
.
//implement row change notification
center=[NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(getDataFromSelectedRow:)
name:NSTableViewSelectionDidChangeNotification
object:nil];
}
- (NSDictionary *)createRecord
{
NSMutableDictionary *record = [[NSMutableDictionary alloc] init];
.
//create record from textFields
.
[record autorelease];
return record;
}
.
//misc. table methods not shown
.
// Display selected data
-(void)getDataFromSelectedRow:(NSNotification*)nn
{
NSTableView *tv=[nn object];
id selectedItem = [records objectAtIndex:[tv selectedRow]];
id theValue = [selectedItem objectForKey:eMail];
NSLog(@"eMail:",theValue);
}
@end