wxBoxSizer
BlitzMax Forums/Brucey's Modules/wxBoxSizer
| ||
The following is generated by wxCodeGen. The screen is split in 2 horizontal halves, then the bottom half is split into 3 vertical pieces. I want to apply a size to the boxsizers. The top part should never be bigger than the default size of the listbox, generaly about a 1/4 of the height of the window. The bottom part should have the middle sizer stretching to fill the gaps. ie the first and third sizer will be a set width. Perhaps i shouldn't be using boxsizers? I have also included the fbp file for the form builder if that helps Cheers Glenn wxCodeGen fbp file email me on glenn at c2d dot co dot nz if you would like the fbp file, although it is 11pm so i might need to get ready for bed in the next hour... work beckons at 6am... |
| ||
. |
| ||
Posts are limited... you'd need to split it. |
| ||
.. or post it elsewhere :-) |
| ||
do you never sleep? i have just emailed the file to you. |
| ||
Anyhoo... try this for your 3 horizontal bits. The first and last, have "proportion" set to zero. The middle one, which you want to fill the space, set "proportion" to 1. That should make the outer two only as wide as the control they hold. |
| ||
do you never sleep? It's only lunch-time here... ;-) (12:07) |
| ||
A zero proportion means, fit to the child size. Hmm, I'm sure someone (Vertex?) listed what the values do... |
| ||
got it. set the top portion to 1 and the bottom portion to 3, that way the top portion uses the top 1/4. same thing for the 3 vertical parts of the bottom portion. i was doing this for the individual controls but missed the obvious thing on the sizers themselves... Cheers Glenn |
| ||
Yeah, it takes a bit of getting used to, but once you do it's very quick to make some quite complex layouts. And the nice thing with sizers is that they'll shuffle themselves around when you run the same app on a different platform (or with different themes), so the layout should always look right no matter the default control sizes. The other sizers, Grid, FlexGrid etc, help you to lay things out where you want separate columns, yet you also want the rows of controls to be lined up also. wxCodeGen uses one on the first page to line up the labels and textfields nicely. |
| ||
i basically copied the layout sequence from the wxcodegen screen. Frame -> Sizer -> Panel -> Sizer -> sizer -> would have had me stumped for ages without that guide. In fact the first time i used it i couldn't lay anything out... |