True alternating row backgrounds for macOS Dark Mode

Why not use the NSTableView instead? You can build on the work of Thomas (it’s open source).

Several reasons, my aim with this code is to be able to apply a solution to a Xojo ListBox, so people can use it without having to rewrite what they’re using a Listbox for currently.

This might seem heretical BUT … when I open your app and run it the listbox on the left appears to match the finders alternating rows but the new one on the right is too dark in its dark color

lol!
Try using a more vibrant desktop picture, even the default Catalina one.

Both left and right use the same exact color constants btw. It’s just how they’re used that’s the difference.

When I switch to light more the listbox doesnt switch (not sure how its set up)
The right hand side does change and looks more like the finder than the “unswitched” listbox
But I dont see any vibrancy differences … hmmmm

edit : I bet that has to do with me having “reduce transparency enabled”

This demo application doesn’t capture and handle the OS changing theme.

The technique used for the right hand side, doesn’t need any manual updating to change the colors. Window tinting is only used in Dark Mode. You can switch the theme on that window by clicking on the help icon.

Ah yes.

Thomas did a great job for the NSTableView … you can almost just remove the Listbox of your project and replace it with the NSTableView of Thomas. All methodes etc… are about the same. :slight_smile:

Except for other platforms of course.

1 Like

Like I mentioned before, there are a couple of reasons as to why I wanted to do this in pure Xojo Code + declares. Once I’m confident that it’s working reliably, I intend to make a solution for the Xojo listbox.

I am hoping that once I am able to improve the Xojo listbox enough in pure Xojo + declares, that Xojo may consider licensing the solution from me, so that they can modernize the Listbox (at least on the Mac), which IMHO is something that desperately needs to be done.

1 Like