NSOutlineView: removing the selected items, what's the easy way?
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.