Issues with wxStaticBoxSizer (GTK build on KDE) Topic is solved

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
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

I've run into an odd issue related to the usage of wxStaticBoxSizer's in a GTK build running on Linux Mint 17.3 KDE 64 bit. The first attached image shows a dialog using the sizer as it looks when opened. As you can see the header of the static box is a bit squashed. The dialog can be resized and if I drag ever so little to resize the width of the dialog the static boxes expands to the expected size - but now the button in the bottom is squashed, as you can se in image 2. I have attached the source code for the dialog.

wxWidgets 3.0.2 has been configured with "--enable-unicode --disable-shared --with-libpng" and build with "SHARED=0 BUILD=release". Is this a known issue? Any workaround?

EDIT: Sorry, unable to add image 2..
Attachments
wxwidgets_gtk2_1.png
wxwidgets_gtk2_1.png (8.69 KiB) Viewed 3278 times
TestDialog.h
(699 Bytes) Downloaded 93 times
TestDialog.cpp
(2.03 KiB) Downloaded 102 times
Last edited by DenDev on Thu Sep 08, 2016 12:08 pm, edited 2 times in total.
I have a bad habbit of not testing the code I post :D
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

Trying to add image 2..
Attachments
wxwidgets_gtk2_2.png
wxwidgets_gtk2_2.png (8.83 KiB) Viewed 3274 times
I have a bad habbit of not testing the code I post :D
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by doublemax »

Did you create the controls as children of the wxStaticBox?
Use the source, Luke!
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

It is created using Code::Blocks / wxSmith, copied from TestDialog.cpp:

Code: Select all

        wxStaticBoxSizer* StaticBoxSizer2;
	wxFlexGridSizer* FlexGridSizer1;
	wxBoxSizer* BoxSizer1;
	wxStaticBoxSizer* StaticBoxSizer1;

	Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
	FlexGridSizer1 = new wxFlexGridSizer(3, 1, 0, 0);
	FlexGridSizer1->AddGrowableRow(0);
	FlexGridSizer1->AddGrowableRow(1);
	StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Label"));
	TextCtrl1 = new wxTextCtrl(this, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
	StaticBoxSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND, 5);
	StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Label"));
	TextCtrl2 = new wxTextCtrl(this, ID_TEXTCTRL2, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
	StaticBoxSizer2->Add(TextCtrl2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	FlexGridSizer1->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND, 5);
	BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
	Button1 = new wxButton(this, ID_BUTTON1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
	BoxSizer1->Add(Button1, 1, wxALL|wxEXPAND, 5);
	FlexGridSizer1->Add(BoxSizer1, 1, wxALL|wxEXPAND, 5);
	SetSizer(FlexGridSizer1);
	FlexGridSizer1->Fit(this);
	FlexGridSizer1->SetSizeHints(this);
EDIT: I have tried to use "StaticBoxSizer*->GetStaticBox()" as parent for the TextCtrl's but that made it worse..
I have a bad habbit of not testing the code I post :D
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by doublemax »

You didn't mention the wxFlexGridSizer before. Can you try to strip the sample down to the absolute mininum to reproduce the issue?
Use the source, Luke!
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

Can't make it any lesser than the attached Code::Blocks project.
Attachments
TestGUI.zip
(6.9 KiB) Downloaded 85 times
I have a bad habbit of not testing the code I post :D
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by doublemax »

As expected: Works fine for me under Windows.

Are you using GTK3? Maybe it's related to this bug: viewtopic.php?f=23&t=42515
Use the source, Luke!
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

It has nothing to do with Windows, so of course the issue is not present there. I'm using a default GTK2 build on Linux Mint 17.3 KDE. I've tried to test the sample application on another computer running Debian Jessie with the same KDE desktop installed. The problem was not present there but the application looked totally different. This issue might be related to GTK being styled under KDE with something like QGtkStyle or QGnomePlatform.

Just such a weird annoyance! #-o
I have a bad habbit of not testing the code I post :D
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by doublemax »

It has nothing to do with Windows, so of course the issue is not present there.
Sizer code is generic, so if the problem was in there, it would be visible under Windows. Maybe it's the font size calculation under GTK(3) like in the other thread i linked.
Use the source, Luke!
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

A static box is not generic, it is a different control on Windows and OSX and Linux. The wxStaticBoxSizer is a sizer utilizing a static box control. The issue might be related to bad font size calculation - but since my build of wx is GTK2 I do not think it is related to GTK3. I think the issue is related to KDE's styling of GTK in order to make GTK applications look like Qt applications even if they are not.
I have a bad habbit of not testing the code I post :D
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by ONEEYEMAN »

Hi, DenDev,
It is possible that KDE uses a GTK theme that is broken on Linux Mint.
I vaguely remember that there was a "not so recent" post to wx-dev/wx-user about theme issue on Linux Mint specifically.

Can you try to change a theme of the KDE and try again?

Thank you.
DenDev
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 231
Joined: Mon Jan 19, 2015 1:45 pm

Re: Issues with wxStaticBoxSizer (GTK build on KDE)

Post by DenDev »

ONEEYEMAN wrote:Hi, DenDev,
It is possible that KDE uses a GTK theme that is broken on Linux Mint.
I vaguely remember that there was a "not so recent" post to wx-dev/wx-user about theme issue on Linux Mint specifically.

Can you try to change a theme of the KDE and try again?

Thank you.
Bulls eye! The "oxygen-gtk" theme was the culprit, switching to another theme removed the issue. Sad though, oxygen theme looks the nicest, but.. ;-)
I have a bad habbit of not testing the code I post :D
Post Reply