• 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
Re: Contextual menus in a NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Contextual menus in a NSTableView


  • Subject: Re: Contextual menus in a NSTableView
  • From: Richard Schreyer <email@hidden>
  • Date: Thu, 20 Dec 2001 18:44:33 -0800

On Thursday, December 20, 2001, at 09:02 AM, Stiphane Sudre wrote:

Is it not problematic that when you control click on a line, this line is not selected ?

I've just discovered this little inconsistency between the traditional Mac OS behavior (which can be seen in the Finder in Icon mode since the list mode is buggy) and this behavior.

In fact, I'm sure it's a more complex topic since it depends on whether you consider the contextual menu to be the one of the selected row(s) or the one of the TableView.


I can't stand Cocoa's default behavior. I fixed it by inserting the following in a subclass of NSTableView

- (void)rightMouseDown:(NSEvent *)theEvent {
NSPoint point = [self convertPoint:[theEvent locationInWindow] fromView:nil];
int row = [self rowAtPoint:point];
[self selectRow:row byExtendingSelection:NO];
[super rightMouseDown:theEvent];
}

This selects the correct row when the user right clicks, although I just noticed it doesn't work when the user control-clicks. Something else for the bug list...

Richard Schreyer


References: 
 >Contextual menus in a NSTableView (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Re: (OT) auto-indent a big hit here
  • Next by Date: Re: Contextual menus in a NSTableView
  • Previous by thread: Re: Contextual menus in a NSTableView
  • Next by thread: Re: Contextual menus in a NSTableView
  • Index(es):
    • Date
    • Thread