I have two questions related to NSOutlineView
:
Why is my Header selectable even though I tell it that it is a Group (otherwise it would not have the "Hide" on the right:
// I am telling the view that the given item is a group by implementing
-(BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item;
I am using a view-based outline and so I can't press Enter or click on a leaf to edit it. Is there a simple way (with the default view-based setup so achieve this functionality).
Please note that I tried to achieve this by binding to editable
on the given column. But the method is never called.
At least I was able to answer the first part of my own question.
I had to implement the method like so in order to make the header unselectable:
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item{
// Add your own logic here to determine whether a cell should be selectable
return ![self isHeader:item];
}
I have created a little sample project that does the following.
Check out besi/mac-quickies on github. Most of the stuff is either done in IB or can be found in the AppDelegate