Contextual menus in view-based NSOutlineView
Contextual menus in view-based NSOutlineView
- Subject: Contextual menus in view-based NSOutlineView
- From: Graham Cox <email@hidden>
- Date: Thu, 12 Jun 2014 10:55:04 +1000
I'm having trouble getting contextual menus to work in a view-based NSOutlineView.
I can set a menu on the whole outline view and that works, but I also need to have menus for each row. Setting a menu on the NSTableCellView subclass in IB doesn't work at all - it seems as if the menu isn't copied when the view is instantiated from the nib (the -menu property is nil on the view instance). But if I override -menu, or -menuForEvent: and return something, it is still not used. In fact those methods are never invoked. If I do the same on the NSTableRowView subclass, then the menu shows, but only if I click in areas that are not occupied by views within my cell view, which is not useful. If the table row gets the menu highlight, then the menu doesn't show (and the -menu method on the row isn't invoked).
I did get this working in a cell-based outline view a few years ago, but with a view-based OV, I can't find the magic fairy dust I need. The simplest way would be just to set up the view's menu in IB, but it seems that's broken or overlooked in the OV implementation. Can anyone suggest a workaround other than those I've tried?
--Graham
_______________________________________________
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