• 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: Finding clicked row in NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding clicked row in NSOutlineView


  • Subject: Re: Finding clicked row in NSOutlineView
  • From: Graham Cox <email@hidden>
  • Date: Tue, 14 Oct 2008 13:31:06 +1100


On 14 Oct 2008, at 1:19 pm, James Walker wrote:

Thanks... Hmm, that will usually do the right thing, but I'm not sure it will always do what I want. Consider this sequence of events:

1. Row 5 is clicked.
2. Row 2 is shift clicked, resulting in rows 2, 3, 4, 5 being selected.
3. Row 3 is shift-clicked, shrinking the selection to 3, 4, 5.


Now, what will [mOutlineView selectedRow] be? The documentation says it returns "the index of the last row selected or added to the selection". No row was added to the selection, so what does "last row selected" mean? If "last" means "most recently", it's unclear, because rows 3 and 4 were selected at the same time. I guess I could experiment.


I believe "last" means "highest numbered", i.e. a spatial index, not a temporal one.


You can always subtract the previous selection from the current one to find what changed:


NSMutableIndexSet* changedSel = [[table selectionIndexes] mutableCopy];
[changedSel removeIndexes:mPreviousSel];
mPreviousSel = [table selectionIndexes];


I do wonder why you need to know though. I wouldn't rely too much on a dynamic quality of a changing selection - better to rely only on the static selection, which you can query at any time.


hth,


Graham _______________________________________________

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


References: 
 >Finding clicked row in NSOutlineView (From: James Walker <email@hidden>)
 >Re: Finding clicked row in NSOutlineView (From: Tito Ciuro <email@hidden>)
 >Re: Finding clicked row in NSOutlineView (From: James Walker <email@hidden>)

  • Prev by Date: Re: Finding clicked row in NSOutlineView
  • Next by Date: Re: Finding clicked row in NSOutlineView
  • Previous by thread: Re: Finding clicked row in NSOutlineView
  • Next by thread: Re: Finding clicked row in NSOutlineView
  • Index(es):
    • Date
    • Thread