Hi,

On 17/03/2011 14:44, sdn.wt...@mailnull.com wrote:

I can understand that, but I was under the impression that the rows in
a BoxSizer had to all be the same size.  Is that not true?

No.

my $sizer = Wx::BoxSizer->new(wxVERTICAL);

Things you add will get allocated space in the vertical direction according to the proportion param to $sizer->Add. If you want things to expand to the full width of the sizer, add wxEXPAND flag.

my $sizer = Wx::BoxSizer->new(wxHORIZONTAL);

Things you add will get allocated space in the horizontal direction according to the proportion param to $sizer->Add. If you want things to expand to the full height of the sizer, add wxEXPAND flag.

So effectively, for a vertical Wx::BoxSizer, you get vertical slots which will expand in the vertical direction.

In terms of getting the minimum size for a control, if the default isn't quite what you want, consider using $control->SetMinSize before adding to the sizer. (or passing a specific size to the constructor). But in general, try to avoid setting specific sizes.

Learn to love sizers and you'll achieve cross-platform happiness. Note that the Wx::Demo example code has to be backwards compatible with many versions of Wx and wxWidgets and also account for the swapping in and swapping out of panels in the demo. In your own code you might not need to call

$window->SetAutoLayout
$window->Fit
$window->Layout

at all and just rely on it all to happen automatically. Just be aware that methods are available to force certain things to happen if you contrive a case where it doesn't work automatically.

Hope this helps.

Regards

Mark













Reply via email to