Question

I'm using a view based NSOutlineView with two different views (both views are custom subclasses of NSTableCellView). In the top level view I display a badge with a counter. The counter indicates the number of entries on the lower level. The counter is implemented as a rounded rect NSButton, following Apple's SidebarDemo project.

As you can see from the images the behaviour of the button upon selection of the cell is not the behaviour you would expect. My button turns black, while in Apple's sample it turns white. I've tracked down the method that sets this particular behaviour for a button to the setHighlightsBy method:

[[self.button cell] setHighlightsBy: 0];

I use the above in the awakeFromNib method of the custom cell class. In the same awakeFromNib I also set the button's bezel:

[[self.button cell] setBezelStyle: NSInlineBezelStyle];

The bezel style works just fine, but the highlighting seems to be ignored.

Further information I can give: The outline view uses bindings to gets its contents, its highlight mode is set to "Source List".

Why is my highlighting being ignored?

enter image description here

enter image description here

Was it helpful?

Solution

Is your button set up in IB (like in the demo project)? If so, do you have the "enable" box checked in the control section of the attributes inspector? I got the behavior you're seeing if I unchecked that box.

OTHER TIPS

I found the cause of the described behaviour, thanks to the suggestion made by @rdelmar in his answer. The button is bound to the Cell View using the "Argument" binding inspector.

enter image description here

One of the settings there is "Conditionally sets enabled", which was enabled and apparently causes auto-disabling of my button. Once you disable this setting, the problem disappears.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top