• 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: Consistent Contextual Menu in NSTableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Consistent Contextual Menu in NSTableview


  • Subject: Re: Consistent Contextual Menu in NSTableview
  • From: Nate Weaver <email@hidden>
  • Date: Mon, 21 Apr 2008 15:37:09 -0500

I would probably override -menuForEvent: instead of -rightMouseDown: .

Leopard also has a bit nicer contextual menu handing for table/outline views: If you right-click a row that's not currently selected it highlights just an outline and doesn't change the selection (you can use -clickedRow to get that row from within your action method(s)).

On Apr 21, 2008, at 11:59 AM, Steve Cronin wrote:
Folks;

I'm having some difficulty getting consistent contextual menu behavior in NSTableView.

In the Finder and iTunes (what I feel most users are familiar with) if a row is selected but the user causes a contextual menu on a different row then row selection changes.
(I don't want to start a UI flame about 'correctness') I'm only interested in consistency!!


NOTE: the contextual menu can appear by a right mouse click, a two- fingered tap, and a control-click which appear to be detected as different events (see below)

The base NSTableView class does NOT change the selection when a contextual click occurs on a row
If I sub-class and add:
- (void)rightMouseDown:(NSEvent *)theEvent {
[self selectRow:[self rowAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]] byExtendingSelection:NO];
[super rightMouseDown:theEvent];
}


I get half-way home. Now the right mouse click and the two-fingered tap will alter the selection.

BUT

the control-click does not.

The Cocoa adage, "if you are working too hard, you probably are" keeps rummaging around my brain....

What is the preferred means to efficiently make consistent contextual menu behavior like Finder and iTunes?

Thanks,
Steve
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Consistent Contextual Menu in NSTableview
      • From: Corbin Dunn <email@hidden>
References: 
 >Consistent Contextual Menu in NSTableview (From: Steve Cronin <email@hidden>)

  • Prev by Date: Re: thread count problem
  • Next by Date: Cocoa support for serial port access?
  • Previous by thread: Consistent Contextual Menu in NSTableview
  • Next by thread: Re: Consistent Contextual Menu in NSTableview
  • Index(es):
    • Date
    • Thread