GTK: wxButton appearance in wxScrolled

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
Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Fri Jan 11, 2019 9:43 am

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?

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

Re: GTK: wxButton appearance in wxScrolled

Post by ONEEYEMAN » Fri Jan 11, 2019 3:42 pm

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.

Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

Re: GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Mon Jan 14, 2019 7:34 am

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?

User avatar
doublemax
Moderator
Moderator
Posts: 13401
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: GTK: wxButton appearance in wxScrolled

Post by doublemax » Mon Jan 14, 2019 7:41 am

Can you show screenshots of the "good" and "bad" buttons?
Use the source, Luke!

Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

Re: GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Mon Jan 14, 2019 8:38 am

Sure. They are:

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

User avatar
doublemax
Moderator
Moderator
Posts: 13401
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: GTK: wxButton appearance in wxScrolled

Post by doublemax » Mon Jan 14, 2019 2:39 pm

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.
Use the source, Luke!

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

Re: GTK: wxButton appearance in wxScrolled

Post by ONEEYEMAN » Mon Jan 14, 2019 3:29 pm

Hi,
I presume you use GTK+2.24.
What happen if you try to upgrade to GTK+3?

Thank you.

Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

Re: GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Mon Jan 21, 2019 12:05 pm

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?

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

Re: GTK: wxButton appearance in wxScrolled

Post by ONEEYEMAN » Mon Jan 21, 2019 5:28 pm

Hi,
You should rebuild wxWidgets by providing '--with-gtk=3'' and then rebuild your software.

Thank you.

Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

Re: GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Mon Jan 28, 2019 10:59 am

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 :-/

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

Re: GTK: wxButton appearance in wxScrolled

Post by ONEEYEMAN » Mon Jan 28, 2019 3:55 pm

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.

Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

Re: GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Tue Jan 29, 2019 7:52 am

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?

Big Muscle
Experienced Solver
Experienced Solver
Posts: 63
Joined: Sun Jun 27, 2010 6:18 pm

Re: GTK: wxButton appearance in wxScrolled

Post by Big Muscle » Thu Feb 28, 2019 12:25 pm

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.

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

Re: GTK: wxButton appearance in wxScrolled

Post by ONEEYEMAN » Thu Feb 28, 2019 4:00 pm

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.

Post Reply