Link to home
Start Free TrialLog in
Avatar of paddycobbett
paddycobbett

asked on

How can I get which row was clicked on a nstableview?

I can't work out how to determine when a row is clicked on a nstableview. A delegate method allows me to determine when a row is selected, but I can't see when a row is clicked. The reason I need to do this is because I need to determine when an already selected row has been clicked again. When developing for the iphone/ipad there is a tableView:didSelectRowAtIndexPath: however I can't find one for nstableview, which only has - (void)tableViewSelectionDidChange:(NSNotification *)aNotification, but it doesn't fire if you click an already selected row.

Any ideas?
Avatar of darbid73
darbid73
Flag of Germany image

You can use the clickedRow in the Tareget-action behavior - see NSTableView Apple Reference
Avatar of paddycobbett
paddycobbett

ASKER

Thanks, I did spot that function but thought it was something you called to query the last selected row, I'm guessing the target-action behavior is for setting up a callback? Could you give a couple lines of code to show me how to set that up? Am new to relatively mac programming.

I tryed going along the lines of:

    [self.tableView setAction:@selector(clickedRow)];
    [self.tableView setTarget:self];

But then what function is called? Please enlighten me! Thanks very much for your help.
ASKER CERTIFIED SOLUTION
Avatar of darbid73
darbid73
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial