0
votes

I am basically trying to recreate the popOver that exists in certain Xcode Settings, like this one in Build Settings:

enter image description here

I have tried both with and without using an NSArrayController to control the content but in each of the tests I ran in to different problems I haven't been able to solve.

Desired Result

  • Complete White Background
  • Multiple Selection and (Single) Editable Cells
  • No Reordering is required
  • When I press the + button I want the new cell to be selected and in edit mode
  • I want to get notification of when text changes while editing to be able to respond to that.

1. Using Delegate Methods.

When I had set up everything up I got this result:

enter image description here

That didn't look good, so I went and selected "Draws Background" for the NSTableViewCell, which resulted in this which looks nice when I edit a cell:

enter image description here enter image description here

But when i just Highlight the cell, it looks like this:

enter image description here

It looks like the highlighting get's placed behind the cell background.

Here I'm stuck and don't know how to fix.

2. Using NSArrayController

When I reconfigure and bind this to an NSArrayController the highlighting looks great:

enter image description here

But when I edit a cell, the entire background changes to grey:

enter image description here

This is also not what I want, but can't figure out what to do about.

--

Notes

In Desired Result I listed some things like "When I press the + button I want the new cell to be selected and in edit mode" and "I want to get notification of when text changes while editing to be able to respond to that." To possibly influence the choice of what route to take, as there are more things about thins TableView I haven't figured out.

But this question Is all about how to fix the highlighting and selection so they stay white all the time, and just selecting a cell looks as expected.

Example Code

Example code for the Delegates Method version:

https://github.com/erikberglund/StackOverflow/tree/master/TableViewDelegates

Example code for the Bindings version:

https://github.com/erikberglund/StackOverflow/tree/master/TableViewBindings

1
Please give a link to github sample. BTW turn on alternating rows for nstableview (checkbox)Marek H
Yes, about the alternating rows, that's about the only thing I would like to leave out and only use a white background.Erik Berglund
Your code is fine on 10.11.(15A279b) Or I didn't get the question postimg.org/gallery/16fmzog4o/ce73258f I did turn off alternating as you wantedMarek H
Yes, that certainly looks fine, and what I would like as well. So now I'm even more confused as to why I get the grey blocks I'm seeing. On your screenshots even the buttons have a white background, which would be my next question which I would tackle after this. As my understanding was that to change a button color you had to subclass it. I am using 6.4 (6E35b) and OS X 10.10.5 (14F27). But that seems weird to make a difference. Because if you look at my screenshots they are not equal to yours, and the code i posted looks the same as my screenshots.Erik Berglund
Try to turn on Core Animation layer on Xcode tab. But as I read in other post Core Animation is slow/buggy on 10.10 with many views. Another try might be cell based nstableview. Try to test it on freshly installed system (10.9,10.10,10.11) in VirtualBox.Marek H

1 Answers

3
votes

Force the appearance to aqua. So instead of inherited select aqua. This solved the issues for me.

Aqua