Yonic
Yonic

Reputation: 317

How to correctly layout wxWidgets/wxGTK items taking their size into account?

Everything inside my application is laid out using sizers with hard-coded border sizes. This makes it fit very nicely inside Windows with wxWidgets:

My application in Windows.

But when I started porting it to Linux with wxGTK, since GTK+3 elements can vary a lot in size, everything ends up being misaligned:

My application in Linux.

Is there a way to responsively layout items taking into account that controls can be in different sizes, and the discrepancies between points and pixels as units of measurement?

Upvotes: 0

Views: 249

Answers (1)

VZ.
VZ.

Reputation: 22688

You can't hard code any sizes to have a fighting chance of a layout working well on different platforms with different font sizes, DPI settings etc. If you're defining your layout in C++, use wxSizerFlags::Border(), DoubleBorder() etc methods. Also, align controls relatively to each other, e.g. using Center() for all the controls that should be in the same row (or use wxFlexGridSizer).

Upvotes: 1

Related Questions