TableView and context menus
TableView and context menus
- Subject: TableView and context menus
- From: "Sven A. Schmidt" <email@hidden>
- Date: Tue, 25 Sep 2001 15:36:47 +0200
I'm trying to add context menus to my TableView object crTable with the
following code (which is based on a hint I found in the archives):
................ .h
NSTableView *crTable;
................ .m
{
NSEnumerator *iter = [ [ crTable tableColumns ]
objectEnumerator ];
NSTableColumn *col;
NSMenu *menu = [ [ NSMenu alloc ] init ];
[ menu addItemWithTitle: NSLocalizedString( @"Run now", @"Run
now context menu item" )
action: @selector(runSelectedCommand) keyEquivalent: @"" ];
while ( col = [ iter nextObject ] )
[ [ col dataCell ] setMenu: menu ];
[ menu release ];
}
It compiles and runs fine, but I won't get any menues. I tried all
combinations of left/right/ctrl clicks with unselected and selected
lines but nothing happens. Only when a cell is highlighted after a
double click do I get the standard text editing context menu (cut, copy,
paste, etc).
What am I doing wrong?
Sven