views:

43

answers:

2

Hi,

I'm searching for an elegant way to detect a right-click/ctrl-click on the header of an NSTableView.

When the right click occurs, I want to display an contextual menu.

- (NSMenu *)menuForEvent:(NSEvent *)

detects only right clicks in the table - not in the header of the table.

thanks for your help.

A: 

You need to subclass NSTableHeaderView and use that subclass as your table's header view.

Wevah
+2  A: 

Get the NSTableHeaderView from the NSTableView and set it's menu.

[[myTableView headerView] setMenu:aMenu];
Nathan Kinsinger
works perfect :) thank you
tubtub