• 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
NSTableView and row selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTableView and row selection


  • Subject: NSTableView and row selection
  • From: Julien Palmas <email@hidden>
  • Date: Thu, 31 Mar 2005 11:30:48 +0900

I am trying to achieve a certain behavior for my NSTableView, but I have some difficulties.

To illustrate what I want, let me give an example.
Imagine that my table view displays cars.
The car class contains the name of the car, and its color.
Let's say I have 3 red cars in my list
car A, car C, and car E.

when I clic on car A, I want all the red cars in the table view to get selected as well.
If I am not mistaken, I should only use a NSIndexSet to set the selection. This is not my tricky part.

So now, I have all the red cars selected. And the user clics on car C (another red car). I don't want the selection to change, obviously. At the beginning, I though that would be easy : just look at the rowIndex the user wants to select and see if it belongs to the already selected IndexSet.

BUT, it looks like I can't get the clicked index !!!! I wanted to use the NSTableView delegate method
<x-tad-bigger>- (BOOL)tableView:(NSTableView *)</x-tad-bigger>aTableView<x-tad-bigger> shouldSelectRow:(int)</x-tad-bigger>rowIndex

but if you clic on an index that is already selected, this method doesn't get called !!
Then how on earth do I know the desired index ??
 _______________________________________________
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

  • Follow-Ups:
    • Re: NSTableView and row selection
      • From: Julien Palmas <email@hidden>
  • Prev by Date: Re: Nested sheets
  • Next by Date: trouble getting c-chars from NSString
  • Previous by thread: Re: Insetting a complex NSBezierPath shape?
  • Next by thread: Re: NSTableView and row selection
  • Index(es):
    • Date
    • Thread