Search code examples
objective-ccocoansoutlineview

NSOutlineView selection does not work


I have an NSOutlineView with a custom datasource (I don't know if this is relevant).

I have only one column (again, I don't know if this is relevant) and I want to perform a specific action upon cell selection, so I thought I should override outlineViewSelectionDidChange. This what I did:

-(void)outlineViewSelectionDidChange:(NSNotification *)notification
{
    NSLog(@"selection changed");
}

But this is not working. I have been playing around in IB with the Outline View, the Table Column and the Text Field Cell properties but so far I had no luck. I don't know if I changed any property that caused this situation or if this is something specific to my specific implementation.

So, anyone's got any clue on what I may be missing?

EDIT: Just in case I'm mis-interpreting the selection concept within an OutlineView, I expected the cells to be selected if I just click on the text outside the area of the expand arrow.


Solution

  • Well after a long struggle, as always, just after I posted my question, I found the answer. The problem is I am using the NSOutlineView in an NSPanel and somehow the NSPanel is not allowing the cells to be selected. If I just move the NSOutlineView to an NSWindow it works just as intended.