views:

10

answers:

1

Hi

I got the next situation: NSOutlineView <-> NSTreeController <-> MyClass

I bind the NSTreeController to an array of objects in MyClass, now I want to get the selected item from the NSOutlineView. For this i declare a NSMutableIndexSet and bind it to the NSTreeController via the "Selection Index Paths" binding how is bound to the NSOutlineView.

I log the description of the index every time that a row is selected and this is the output: " 1 indexes [3, 1]" what looks good.

Now, how can I actually get the value of this index? If i try:

[selection firstIndex]

, for example, i got a '-[NSCFArray firstIndex]: unrecognized selector sent to instance'.

Thanks

A: 

The solution:

NSIndexPath *index = [(NSArray *)selection objectAtIndex:0]

Then i can read the 'index' in this way:

for (int i = 0; i < [index length]; i++){
...
[index indexAtPosition:i]
...
}
GojaN