size of elements Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
El_isra
Knows some wx things
Knows some wx things
Posts: 39
Joined: Tue Apr 13, 2021 1:10 am
Location: Buenos Aires, Argentina
Contact:

size of elements

Post by El_isra » Mon Apr 19, 2021 8:00 pm

my GUI looses it's proportion on other machines.
I already know i Have to use Sizers, but i dont know wich one's to use, or how to use them ( i haven't found any tutorial yet)
i'm using codeblocks to manage the project.
could you point me into a tutorial or guide on how to use them properly?

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

Re: size of elements

Post by doublemax » Mon Apr 19, 2021 8:03 pm

I think this is a good introduction to understand the basic concept behind sizers:
http://neume.sourceforge.net/sizerdemo/
Use the source, Luke!

El_isra
Knows some wx things
Knows some wx things
Posts: 39
Joined: Tue Apr 13, 2021 1:10 am
Location: Buenos Aires, Argentina
Contact:

Re: size of elements

Post by El_isra » Tue Apr 20, 2021 12:33 pm

sizers only work for element layout?
some users reported some buttons and text become bigger.

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

Re: size of elements

Post by doublemax » Tue Apr 20, 2021 1:56 pm

El_isra wrote:
Tue Apr 20, 2021 12:33 pm
sizers only work for element layout?
Yes.
El_isra wrote:
Tue Apr 20, 2021 12:33 pm
some users reported some buttons and text become bigger.
No, sizers don't do that.
Use the source, Luke!

El_isra
Knows some wx things
Knows some wx things
Posts: 39
Joined: Tue Apr 13, 2021 1:10 am
Location: Buenos Aires, Argentina
Contact:

Re: size of elements

Post by El_isra » Wed Apr 21, 2021 1:38 pm

i got the answer!
it seems that the default Font configuration used by Code::Blocks Wizard for wxWidgets projects caused the issue.
setting a custom font & size for every frame & dialog solved the bug.

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

Re: size of elements

Post by ONEEYEMAN » Wed Apr 21, 2021 5:41 pm

Hi,
You definitely should be using sizers and not trying to tweak the font/size unless absolutely necessary.

As doublemax said - sizers are doing layout for you.

In the beginning it is better to have some RAD tool to create GUI (if you don't use C::B/CodeLite, you can use wxGlade), then look at the generated code.

You will thank people in the long run for creating a layouts that will be working independently of resolution, OS, theme and any defaults there is.

Thank you.

Post Reply