Re: Contextual menus not passing mousedown events
Re: Contextual menus not passing mousedown events
- Subject: Re: Contextual menus not passing mousedown events
- From: Axel Andersson <email@hidden>
- Date: Wed, 22 Jun 2005 15:23:17 +0200
On Jun 22, 2005, at 03:15, Theodore H. Smith wrote:
What am I doing wrong? How do I first let the mousedown event pass,
so the row the user clicked on is selected, before opening the menu?
I'm doing the following in an NSTableView subclass when I want that
behaviour:
- (NSMenu *)menuForEvent:(NSEvent *)event {
int row;
row = [self rowAtPoint:[self convertPoint:[event
locationInWindow] fromView:nil]];
if(row >= 0) {
if(![self isRowSelected:row])
[self selectRow:row byExtendingSelection:NO];
return [super menuForEvent:event];
}
return nil;
}
-selectRow:byExtendingSelection: was deprecated in Mac OS X 10.3, but
you get the idea.
Hope this helps,
-- Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden