tags:

views:

210

answers:

1

How do I get the selected item of an NSOutlineView with using my own data source. I see I can get selectedRow but it returns a row ID relative to the state of the outline. The only way to do it is to track the expanded collapsed state of the items, but that seems ridiculous.

I was hoping for something like:

array = [outlineViewOutlet selectedItems];

I looked at the other similar questions, they dont seem to answer the question.

+1  A: 

NSOutlineView inherits from NSTableView, so you get nice methods such as selectedRow:

id selectedItem = [outlineView itemAtRow:[outlineView selectedRow]];
Dave DeLong
Thank you SO much that works just as intended. I wish it was easier to find it in the Apple docs...
Ronaldo Nascimento