Page 1 of 1

GTK: wxButton appearance in wxScrolled

Posted: Fri Jan 11, 2019 9:43 am
by Big Muscle
Hello,
I develop an C++ application for Raspberry PI using wxWidgets (GTK2).
When I create a button in wxPanel, it looks correctly. But if I change wxPanel to wxScrolledWindow (or wxScrolled<wxPanel>), the buttons appearance changes it - thick white border appears around it. Even if I change the button background colour, the white border stays there.

The code to reproduce is very simple:

Code: Select all

class CScreen :
	public wxScrolled<wxPanel>
{
public:
	CScreen(CMainWindow* pParent) : wxScrolled<wxPanel>(pParent) {
		wxButton* button = new wxButton(this, wxID_ANY, L"BUTTON");
		button->SetBackgroundColour(wxColour(0, 0, 255));
	}

};
The same code works correctly on Windows.

Is it some known problem or is there some solution/workaround for it?

Re: GTK: wxButton appearance in wxScrolled

Posted: Fri Jan 11, 2019 3:42 pm
by ONEEYEMAN
Hi,
Are you trying to test on Raspberri or you have an actual {VM} machine with Linux installed?
Maybe it is theme specific - which theme do you use? Did you try to change it?

Thank you.

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 14, 2019 7:34 am
by Big Muscle
Hello,
it is the real Raspberry with Raspbian 9.6 installed.
If it is the theme specific why would it influence only buttons on wxScrolledWindow and not the other buttons?

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 14, 2019 7:41 am
by doublemax
Can you show screenshots of the "good" and "bad" buttons?

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 14, 2019 8:38 am
by Big Muscle
Sure. They are:

Good:
good.jpg
good.jpg (47.93 KiB) Viewed 516 times
Bad:
bad.jpg
bad.jpg (51.79 KiB) Viewed 516 times

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 14, 2019 2:39 pm
by doublemax
Well, it's not only the white border, also the background gradient and rounded corners are gone. This looks like a theme-problem to me, but i have no idea what to do about it.

Can you try to use wxScrolledCanvas instead of wxScrolledWindow? It's a very wild guess, it really shouldn't make any difference.

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 14, 2019 3:29 pm
by ONEEYEMAN
Hi,
I presume you use GTK+2.24.
What happen if you try to upgrade to GTK+3?

Thank you.

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 21, 2019 12:05 pm
by Big Muscle
I'm not sure about GTK+3. I have no experience with it.
Is it possible to use it just by rebuilding my app only, or does it require complete wxWidgets rebuild / additional system packages?

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 21, 2019 5:28 pm
by ONEEYEMAN
Hi,
You should rebuild wxWidgets by providing '--with-gtk=3'' and then rebuild your software.

Thank you.

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 28, 2019 10:59 am
by Big Muscle
It took almost 2 hours to rebuild on Raspberry but now it is done. The application starts and no controls are visible at all, so hard to answer the question :-/

Re: GTK: wxButton appearance in wxScrolled

Posted: Mon Jan 28, 2019 3:55 pm
by ONEEYEMAN
Hi,
That's weird.
Now, what happen if you try to run you code in the actual desktop/laptop hardware and not Raspberry PI? With both GTK+2 and GTK+3.

As doublemax said it does look like a theme problem. Can you try to select another one?

Thank you.

Re: GTK: wxButton appearance in wxScrolled

Posted: Tue Jan 29, 2019 7:52 am
by Big Muscle
After some experiments, I noticed that GTK+3 has some problem with sizers. Application started directly on X-server startup works correctly, application started manually later does not display controls put in sizers. So I made some modification to remove sizers and I can confirm that "wxButton appearance" problem does not appear on GTK+3.

And I can confirm it is definitely theme (PiX theme) problem. When I use "SetNativeTheme(L"Arc");" in GTK+2 app, then problem disappears too. The question is why it influences buttons in wxScrolled only?

Re: GTK: wxButton appearance in wxScrolled

Posted: Thu Feb 28, 2019 12:25 pm
by Big Muscle
I will not create new topic about it, but I noticed this problem does not apply to buttons only. There is some more global theming problem with wxScrolled.

For example, applying wxBORDER_* flag on wxScrolled<wxPanel> results in obsolete border appearance which does not correspond to used theme. Normal wxPanel has correct border.

Re: GTK: wxButton appearance in wxScrolled

Posted: Thu Feb 28, 2019 4:00 pm
by ONEEYEMAN
Hi, guys,
If you can replicate the problem in the minimal sample, could you create a ticket in trac.wxwidgets.org?
Mention you platform/toolkit, configuration options and what to do to see the problems. And if you can debug it and find what is happenning it will be even better.

This forum is for wx-users by wx-users. Core devs are not coming here.

Thank you.