> On Nov 5, 2015, at 2:35 PM, Raglan T. Tiger <r...@crusaderrabbit.net> wrote:
> 
> I subclass NSTableView to catch -rightMouseDown 
> 
> In -rightMouseDown I call [self clickedRow] which always returns -1 in a row 
> or not in row
> 
> What should I be doing to get the clicked row?


If the reason you’re capturing right-click events is to put up a context menu, 
it’s much simpler just to connect the outline view’s -menu outlet in Interface 
Builder, which in addition to setting -clickedRow, will also automatically 
highlight the clicked row in the UI, making for a nicer user experience. If you 
need to customize the menu based on events at runtime, you can override 
menuForEvent: and return your custom menu based on the event. Unfortunately, 
when you do it this way you get neither -clickedRow nor the UI selection. It’s 
still probably more correct than overriding rightMouseDown:, though.

Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to