wxComboBox black panel

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
murena
In need of some credit
In need of some credit
Posts: 4
Joined: Fri Sep 15, 2017 12:52 pm

wxComboBox black panel

Post by murena »

Dear all,
I'm working on Ubuntu 16 with wxWidgets last issue and c++.
i'am facing a little problem with wxComboBox : I can set the background and the foreground color of the items. When I open the widgets and it shows the panel with the list of items, this panel is always dark grey instead of the background choosen form the item.
With the wxFormBuilder the result is the same.

Thanks in advance for the help.

stefano
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxComboBox black panel

Post by ONEEYEMAN »

Hi,
Could you please take a screenshot so that we understand what is wrong and attach it along with some code?
It would also be nice if you could try top reproduce the issue in the widgets sample with as minimal as possible changes (if necessary).

Thank you.
gerryg001
Earned a small fee
Earned a small fee
Posts: 10
Joined: Thu Jul 30, 2015 10:33 pm

Re: wxComboBox black panel

Post by gerryg001 »

Okay, it sounds as though I may be in the same place. In my case I am not setting any colors, and just have a very generic wxComboBox with wxCB_DROPDOWN. On the dropdown, the background now is black, with the text dark grey. Moving the cursor, as selected the background becomes red with white text.

This impacts two apps that were written over a decade ago. They were recently rebuilt for minor changes elsewhere in the app, so I'm unsure exactly when this happened. I looked over the code in fine detail, and there's nothing to explain this change.

I then took a separate test app and used wxGlade to generate new code for a wxComboBox, and got the same result.

As I'm sure this was fine several months ago, the only changes I can imagine would be from Ubuntu 16.04 updates or more likely GTK. The current wxWidgets sample set doesn't appear to have a generic wxComboBox, and the variations it does include seem to work.

With a very fuzzy memory, I seem to recall this issue about ten years ago, but I may be wrong there. Of course, if one thinks back far enough, nearly everything can be found...

wxwidgets 3.0.2.0
Ubuntu 16.04.3 LTS
4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
libgtk-3-0:amd64 3.18.9-1ubunt amd64
libgtk2.0-0:amd6 2.24.30-1ubun amd64

wxComboBox.png
wxComboBox.png (20.3 KiB) Viewed 2340 times
coderrc
Earned some good credits
Earned some good credits
Posts: 141
Joined: Tue Nov 01, 2016 2:46 pm

Re: wxComboBox black panel

Post by coderrc »

I dont want to lead you down a rabbit hole, but my first guess would be that its a theme issue. Like maybe your current theme doesnt specify combobox colors so it defaults to a different theme's settings.

the fastest way to test would be to try some other themes and see if it affects the combobob colors.

IIRC the wxwidgets color setting functions for list boxes and their ilk only work on windows, the gtk variants only respect the current system theme.
gerryg001
Earned a small fee
Earned a small fee
Posts: 10
Joined: Thu Jul 30, 2015 10:33 pm

Re: wxComboBox black panel

Post by gerryg001 »

coderrc wrote:I dont want to lead you down a rabbit hole,
coderrc, as soon as I read your response, a few memories started coming back. No rabbit hole here, but likely the same issue I had a decade ago. As wxwidgets uses many native controls, my next step was to bring up the Unity Tweak Tool. That has 3 themes available, so I just change to another theme then start up my app...

And, like magic, the problem goes away, proving you are right. A recent update from the Ubuntu repository must have changed some of the colors associated with the default Ambiance GTK theme.

I don't think that wxwidgets can change this directly. I could put a gtk_ call in the app, but would rather not. Checking wx-config, it appears this wxwidgets build (from the Ubuntu repository for xenial) is set for gtk-2. Possibly the simplest way is to patch the mistake that will be in /usr/share/themes/Ambiance/gtk-2.0 and leave an update note to reference that.

But, from here this goes downhill...

Comparing the gtkrc files for two themes, there is a note in each file about a combobox dropdown bug and a workaround, but that links to a bug from 2006 that was closed, but (from 2015) this is not going to be fixed in gtk 2.x. From those dates, this is likely the long-ago bug that I remembered. However, comparing the two gtkrc files, I can't see any difference that would cause this.

# Work around for http://bugzilla.gnome.org/show_bug.cgi?id=382646
# Note that this work around assumes that the combobox is _not_ in appears-as-list mode.
widget_class "*.<GtkComboBox>.<GtkCellView>" style "text_is_fg_color_workaround"
# This is the part of the workaround that fixes the menus
widget "*.gtk-combobox-popup-menu.*" style "menuitem_text_is_fg_color_workaround"

-----------
But, I carefully saved then put the gtk-2.0/gtkrc from Radiance into Ambiance, and that DID solve my app problem with the combobox. So, I either have to keep searching through those files, or try to download the previous version to compare against.

In either case, that's not the way I really wanted to spend my day. Any further terrific suggestions would be appreciated!
gerryg001
Earned a small fee
Earned a small fee
Posts: 10
Joined: Thu Jul 30, 2015 10:33 pm

Re: wxComboBox black panel [SOLVED]

Post by gerryg001 »

For any interested, the issue was an update change to a theme file for Ubuntu Xenial.

dpkg -S /usr/share/themes/Ambiance/gtk-2.0/gtkrc
light-themes: /usr/share/themes/Ambiance/gtk-2.0/gtkrc

Downloading the last two updates on that light-themes package, I extracted and compared this gtkrc file, finding it changed:

style "menubar" {

style "menubar" = "dark" {

--------------
Backing up and noting my local copy, removing that "dark" resolves the wxwidgets app issues with the combobox dropdowns. Thus far, I haven't found anything else broken from this.
Post Reply