Combobox; Background Color;

On windows, how can I set the background color of a combobox?
Any MBS class available?

Any help for this sophisticated behaviour really apreciated!

Here you go:

https://www.dropbox.com/s/k4nmpw589rfolov/ComboBoxBackgroundColor.xojo_binary_project?dl=1

Its just to get you started, there’s two Inspector properties to colour the combo and the list. You’ll need to fill it out a bit to cope with things like changing colour at runtime if you want to do that, just destroy the Brush and make a new one with the right colour.

Is it Microsoft (Windows) kosher ?

Just tested it in Windows 7, 8.1 and 10 and it looks fine (after fixing a Win7 bug), redownload it if you want the bug fix.

Hello Julian!

Great. It works!
Many stuff to add… hopefully I can encapsulate this in another… oh wait… it’s Xojo;-)

Thanks a lot!!!

Oh I forgot to mention, try to keep your brushes and re-use them for as long as possible between paints as the process can cause overhead if you create and destroy them for every paint. Have fun :slight_smile:

I’ve just made it 64bit safe and put in a fix for a bug with 2018r1 64bit, see <https://xojo.com/issue/52211> for more info.

You only need to redownload it if you need 2018r1 64bit support.

The changes are in Window1.Open and Window1.NewWndProc

Great work, @ !

Any guidance on making it work for windows desktop apps with several windows with several comboboxes of different colors?

I just started to play with it. Any help is welcome!

Have a look at the WindowProc usage in the Windows Functionality Suite as its a more complete solution to hooking windows (mine is just thrown together to get the example working), take a look at a few of the demos in that project that use WndProc then try to migrate/merge that into your project.

As I mentioned above keep your brushes as long as you’re using them, maybe create an array of them and search that to see if you have made one already as it’s quicker than making them for each paint.