Consistent Contextual Menu in NSTableview
Consistent Contextual Menu in NSTableview
- Subject: Consistent Contextual Menu in NSTableview
- From: Steve Cronin <email@hidden>
- Date: Mon, 21 Apr 2008 11:59:13 -0500
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