• 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: Selecting rows in NSOutlineView from menuForEvent:?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting rows in NSOutlineView from menuForEvent:?


  • Subject: Re: Selecting rows in NSOutlineView from menuForEvent:?
  • From: Laurent Daudelin <email@hidden>
  • Date: Fri, 9 Apr 2010 14:42:42 -0700

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              				email@hidden
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries_______________________________________________

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: Selecting rows in NSOutlineView from menuForEvent:?
      • From: Nick Zitzmann <email@hidden>
References: 
 >Selecting rows in NSOutlineView from menuForEvent:? (From: Laurent Daudelin <email@hidden>)
 >Re: Selecting rows in NSOutlineView from menuForEvent:? (From: Nick Zitzmann <email@hidden>)

  • Prev by Date: Re: Selecting rows in NSOutlineView from menuForEvent:?
  • Next by Date: Re: Selecting rows in NSOutlineView from menuForEvent:?
  • Previous by thread: Re: Selecting rows in NSOutlineView from menuForEvent:?
  • Next by thread: Re: Selecting rows in NSOutlineView from menuForEvent:?
  • Index(es):
    • Date
    • Thread