handle and layouting widgets 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
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 543
Joined: Wed Apr 05, 2006 9:39 am

handle and layouting widgets

Post by MoonKid » Thu Apr 06, 2006 8:39 pm

I found no doc about layouting widgets.

Are there layout-classes like in Qt?

I know I could read the samples and the classes doc. But it does not help me to understand the hole concept around the widget-layouting.

Can't get richer than this
Can't get richer than this
Posts: 864
Joined: Thu Jul 28, 2005 9:48 pm
Location: New Forest, United Kingdom

Post by Sof_T » Thu Apr 06, 2006 9:00 pm

wxWidgets uses the concept of sizers to constrain widgets and handling widget resizing. There are several different sizers to handle different layouts. This is an fragment of the introduction:
The layout algorithm used by sizers in wxWidgets is closely related to layout systems in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit. It is based upon the idea of individual subwindows reporting their minimal required size and their ability to get stretched if the size of the parent window has changed. This will most often mean that the programmer does not set the start-up size of a dialog, the dialog will rather be assigned a sizer and this sizer will be queried about the recommended size. This sizer in turn will query its children (which can be normal windows, empty space or other sizers) so that a hierarchy of sizers can be constructed. Note that wxSizer does not derive from wxWindow and thus does not interfere with tab ordering and requires very few resources compared to a real window on screen.

What makes sizers so well fitted for use in wxWidgets is the fact that every control reports its own minimal size and the algorithm can handle differences in font sizes or different window (dialog item) sizes on different platforms without problems. For example, if the standard font as well as the overall design of Linux/GTK widgets requires more space than on Windows, the initial dialog size will automatically be bigger on Linux/GTK than on Windows.

There are currently five different kinds of sizers available in wxWidgets. Each represents either a certain way to lay out dialog items in a dialog or it fulfills a special task such as wrapping a static box around a dialog item (or another sizer).
For more info look in the documentation in the overview section under sizers overview or under wxSizer.

The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++

I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Post by cpp » Fri Apr 07, 2006 12:01 am

I found no doc about layouting widgets.
Look a little harder, its right there on the docs :D

NE Way, Heres how i got to understand it.

1.- Download & install the evaluation version of DialogBlocks (you can find a link in the "usefull tools" section of the wxWidgets site.

2.- create a project, and start designing a dialog, take a look at the intruction and small sample that comes with dialogBlocks, checkout the code it generates, and try to understand it (is not too hard), when you dont understand something, checkout the documentation for that particular thing you dont understand.

i did this for a couple of days and got a pretty decent understanding of how the layout system works.

Hier Kommt die Sonne...

Post Reply