Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect a NSTableView row is selected when it already selected?

I have a NSTableView with many rows that a user can select. When a user selected a row, I get the

- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row

NSTableViewDelegate method call, which is awesome. When the user clicks that row, I highlight it.

The problem, however, is that I do not get the delegate call again when the user "selects" the row again (Without deselecting the row or selecting another row).

For example, a user clicks a certain row and certain files load. If the user was to select that row again, I would like to refresh the files loaded. I do not, however, get the second time the user clicks the row.

One option would be the deselect the row, but I need to keep it selected so the user knows which option they have selected.

Is there a delegate method that I have missed that tells me when a row is selected (or clicked) when it is already selected?

Thanks in advance!

like image 464
Will Avatar asked Mar 25 '14 20:03

Will


1 Answers

While writing this question I found the answer under the suggested similar questions so I will write what I found:

On this question it was suggested to use an IBAction for clicking the NSTableView. This worked great as I would always get the IBAction call even if the row was selected. I then was able to just get rid of my implemention of the - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row method!

Hope this helps someone else!

like image 77
Will Avatar answered Dec 31 '22 20:12

Will