• 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
NSOutlineView: removing the selected items, what's the easy way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSOutlineView: removing the selected items, what's the easy way?


  • Subject: NSOutlineView: removing the selected items, what's the easy way?
  • From: Allan Odgaard <email@hidden>
  • Date: Mon, 8 Jul 2002 22:41:23 +0200

Hi there,

I have an NSOutlineView and want to allow the user to remove the selected items.

Using the enumerator method I get the indices of the selected rows, but these indices refer to the visible index, and thus vary depending on the which items are collapsed/expanded.

Either I go through the NSOutlineView's items while also traversing my own datastructure, and remove items when I find a match (O(n) granted the enumerator outputs the indices in ascending order), or I convert the indices to item pointers and search for each (O(m*n) where m is the number of selected items) -- I need to search because it's a hierarchical datastructure -- alternatively I could tag each item with it's parent, so that it coudl be removed without the search, but I dislike this overhead.

So I'd be interested to hear how others handle this rather simple problem, which unfortunately have turned out to involve quite a lot of code... maybe I should just tag my items, as it's only a constant overhead...
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: NSOutlineView: removing the selected items, what's the easy way?
      • From: Itrat Khan <email@hidden>
  • Prev by Date: Re: NSText textDidChange: doesn't report undo in text view
  • Next by Date: Re: Getting mouse clicks on cells
  • Previous by thread: Re: Getting mouse clicks on cells
  • Next by thread: Re: NSOutlineView: removing the selected items, what's the easy way?
  • Index(es):
    • Date
    • Thread