Hi lads,
after a little but of help with an NSTableView. i have a 2 column table view and so far i am populating it with data, and its going well. i have got abit of a problem tho.
I cannot work out how to get the info back when the user clicks a row in the TableView. I am using the following code to pickup on the return of data but when it goes to NSLog i am getting multiple entries, also when i move the mouse to another entry without clicking on it, NSLog shows that data as well.
how do i go about just getting the data when the user clicks on a row and not when it changes row?
the code was taken from a bigger example i had, where does the return statement just below the NSLog line put the data?
after a little but of help with an NSTableView. i have a 2 column table view and so far i am populating it with data, and its going well. i have got abit of a problem tho.
I cannot work out how to get the info back when the user clicks a row in the TableView. I am using the following code to pickup on the return of data but when it goes to NSLog i am getting multiple entries, also when i move the mouse to another entry without clicking on it, NSLog shows that data as well.
Code:
- (id)tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn *)tc row:(int)row
{
if ([[tc identifier] isEqualToString:@"city"])
{
NSLog([[tableArray objectAtIndex:row] city]);
return [[tableArray objectAtIndex:row] city];
}
else
{
return [[tableArray objectAtIndex:row] nickname];
}
}
how do i go about just getting the data when the user clicks on a row and not when it changes row?
the code was taken from a bigger example i had, where does the return statement just below the NSLog line put the data?