1

What I'd like to have is that when a row in my view-based table view is selected, the images (or button images) get inverted, like in Safari:

Inverted button image in selected table view row

I already have a button with the NSStopProgressFreestandingTemplate image (Stop progress image), but nothing happens when the row is selected. The text correctly becomes white.

Nickkk
  • 2,261
  • 1
  • 25
  • 34

2 Answers2

0

What style of NSButton are you using? I just tried adding one into my view-based NSTableView project, I set it to a style of 'Inline' with the NSStopProgressFreestandingTemplate image and it correctly turns white with text when I select a table row.

Seb Jachec
  • 3,003
  • 2
  • 30
  • 56
  • Thanks for your help! I've noticed that something changes when selecting it and the "Bordered" attribute is enabled, but without it, nothing. And it just doesn't look good with the border. – Nickkk Apr 16 '15 at 22:05
  • @Nickkk That's peculiar. I un-checked the Bordered attribute when I tried it and it worked fine. Couple of questions: are you using the 'Inline' button style? What button 'type' are you using, and are you setting the image via the .xib file or via code? – Seb Jachec Apr 17 '15 at 17:02
  • I just dragged an Inline button into my table view and unchecked the Border attribute, so I left the default button style ("Momentary Push In"). The image is also set in the .xib file. I also noticed that when I click the button and its row is selected, the image is inverted after the mouse is up again, but deselecting and selecting the row again brings it back to not inverted. – Nickkk Apr 18 '15 at 17:24
0

It turned out that this problem was caused by the NSTableCellView having a Core Animation Layer. (It's funny to know how many problems can be solved by disabling a CALayer.) I would have never thought of that, so I had to compare the source code of the "buggy" .xib file and of a new one which worked.

Nickkk
  • 2,261
  • 1
  • 25
  • 34