On Apr 9, 2010, at 14:10, Nick Zitzmann wrote: > > On Apr 9, 2010, at 2:46 PM, Laurent Daudelin wrote: > >> I wrote a subclass of NSOutlineView to handle menuForEvent: so that I can >> provide my own menu of items that can be performed. It works well but I did >> notice that in all other outline or table views, a right-click will >> highlight the rows that were right-click with an outline and change the view >> selection to the row(s) that were clicked by the right-click. How can I do >> that? > > Did you try overriding -rightMouseDown: to make the selection & then invoke > the superclass? You can make the selection by taking the event location, > converting it from window to view coordinates, and then using -rowAtPoint: to > get the row number.
Nick, I am using this now: [[self window] makeFirstResponder:self]; NSIndexSet *selectedRowIndexes = [self selectedRowIndexes]; NSPoint mousePoint = [self convertPoint:[theEvent locationInWindow] fromView:nil]; int row = [self rowAtPoint:mousePoint]; if ([selectedRowIndexes containsIndex:row] == NO) { [self selectRow:row byExtendingSelection:NO]; } However, the selection is the standard highlight, not the outline I see in any other table views in other Apple applications. I'll see what I can do with rightMouseDown: Thanks! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@gmail.com Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com