I\'m looking for a way to get right-clicked row index from NSTableView but I can\'t find any delegate methods or class attributes for it. Any suggestion is appr
Just select row on right-click by implementing menuForEvent: in NSTableView subclass:
@implementation MyTableView
- (NSMenu *)menuForEvent:(NSEvent *)theEvent
{
int row = [self rowAtPoint:[self convertPoint:theEvent.locationInWindow fromView:nil]];
if (row == -1)
return nil;
if (row != self.selectedRow)
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
return self.menu;
}
@end