Sizes of application components

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
gabre
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sat Mar 02, 2013 9:45 am

Sizes of application components

Post by gabre » Thu Jun 27, 2013 8:27 am

I faced the following: on different systems the default font is different, so texts are often too big for my fix-sized buttons (I absolutely need them to be fixed sized). I tried to set the font (with setFont) of my main frame but it doesnt work, I mean, if I modify font size to 6pt nothing changes. (I thought that cause of parent-children relationship between widgets all of them will have the same text size)
Another problem: how should I use sizers and spacers to achieve the following:
- if there is enough space the spacers reserve the space according to their width/height (and keep the widgets positioned "far" from each other)
- if there is no space (e.g. the screen / resolution is not big enough) the spacers decrease the space allocated to them (e.g. decrease their height/width)
(another question: if there are no spacers / no space between widgets, but the widgets are still too big, what can I do to make my application usable? I cant really decrease the size of my widgets, but I scroll bar appearing on the right/left side of my app would be also a solution).

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: Sizes of application components

Post by eranon » Thu Jun 27, 2013 8:57 am

About sizers (and spacers), maybe you should relay on a good (I mean "good for you" ; everyone having his own requirements) UI designer tool which will grandly ease the sizer concept for you. On my side, I'm using wxSmith which is a Code::Blocks's plugin (codeblock being the IDE I use)... This way I just have to understand the wxSmith spirit and adjust settings through its properties grid.

Known GUI builders are listed here : http://wiki.wxwidgets.org/Tools#Rapid_A ... I_Builders.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]

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

Re: Sizes of application components

Post by doublemax » Thu Jun 27, 2013 9:00 am

I tried to set the font (with setFont) of my main frame but it doesnt work, I mean, if I modify font size to 6pt nothing changes. (I thought that cause of parent-children relationship between widgets all of them will have the same text size)
That should work, but you must set the font size of the parent before you create the children.
Use the source, Luke!

gabre
Knows some wx things
Knows some wx things
Posts: 29
Joined: Sat Mar 02, 2013 9:45 am

Re: Sizes of application components

Post by gabre » Thu Jun 27, 2013 11:32 am

With wxErlang there is no way to use such a tool like wxSmith, I have to do everything from code. :S

User avatar
T-Rex
Moderator
Moderator
Posts: 1204
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: Sizes of application components

Post by T-Rex » Thu Jun 27, 2013 5:58 pm

You probably could use DialogBlocks, it can generate XRC and then you will just load layout from XRC in your code.

Post Reply