Re: -clickedRow
Re: -clickedRow
- Subject: Re: -clickedRow
- From: Charles Srstka <email@hidden>
- Date: Fri, 06 Nov 2015 15:16:01 -0600
> On Nov 5, 2015, at 2:35 PM, Raglan T. Tiger <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden
References: | |
| >-clickedRow (From: "Raglan T. Tiger" <email@hidden>) |