• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
TableView and context menus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: TableView and context menus
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Enumerated lists - (Sorry for the stupid questions.)
  • Next by Date: assigning delete key to menu item
  • Previous by thread: Re: Enumerated lists - (Sorry for the stupid questions.)
  • Next by thread: Re: TableView and context menus
  • Index(es):
    • Date
    • Thread