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
wxComboBox black panel
Re: wxComboBox black panel
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.
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.
Re: wxComboBox black panel
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
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
Re: wxComboBox black panel
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.
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.
Re: wxComboBox black panel
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...coderrc wrote:I dont want to lead you down a rabbit hole,
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!
Re: wxComboBox black panel [SOLVED]
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.
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.