I have NSTableView object. I need to invoke the menu associated with it at my control at any point of time. And through that I should invoke menuNeedsUpdate method for menu updates.
class MyClass
{
IBOutlet NSTableView *tableView;
IBOutlet NSMenu *mMenu;
}
//methods
void menuNeedsUpdate:(NSMenu*)inMenu
{
// do menu settings here
}
void myMethod:(id)inTableView
{
NSInteger row = [inTableView selectedRow];
//some condition checking here
// invoke menu of the tableView
}
I prefer to subclass NSTableView and implement
- (NSMenu *)menuForEvent:(NSEvent *)theEventA tipical way to get row is