Hi,

See Wx::Demo.

If you decide you still need a Wx::FlexGridSizer, your missing bits are

$tsz->AddGrowableCol( $colnumber, $proportion );

for the columns you want to allow 'grow' in the horizontal direction,

and

$tsz->AddGrowableRow( $rownumber, $proportion );

for the rows you want to allow 'grow' in the vertical direction

Your flags to ->Add should then work as expected.

My personal practice for a layout like this is generally to use a simple Wx::BoxSizer as the main sizer for the window or panel, then for a case like yours I'd add a Wx::FlexGridSizer to it for my general items plus a horizontal Wx::BoxSizer last to hold buttons.

$sizer->AddStretchSpacer is your friend if you have a fixed window or panel size and always want something like buttons to appear at the bottom.

e.g. - flexsizer only expanding in horizontal direction

my $mainsizer = Wx::BoxSizer->new(wxVERTICAL);
my $flexsizer = Wx::FlexGridSizer->new(5,5,5,5);
my $buttonsizer = Wx::BoxSizer->new(wxHORIZONTAL);

.... add controls

$mainsizer->Add($flexsizer, 0, wxEXPAND|wxALL, 0);
$mainsizer->AddStretchSpacer(1);
$mainsizer->Add($buttonsizer, 0, wxEXPAND|wxALL, 0);

$self->SetSizer($mainsizer);

As always, TMTOWTDI

Hope this helps


Mark

On 17/03/2011 13:28, sdn.wt...@mailnull.com wrote:
I just can't figure out sizers.  Some days I think I never will.

Here: http://nopaste.info/223222a025.html is a very simple wxperl program.  It 
displays a header line, then a cluster of controls, then a button at the 
bottom.  I used two sizers: a top-level one with three rows and one column (for 
the three sections I just described), and one in the middle for the central 
cluster of controls.

Everything displays fine, but nothing happens when the window resizes.  Nothing 
moves around.  The button is supposed to be anchored to the bottom -- but it 
doesn't move when the window gets taller.

I keep juggling the options, trying various combinations of wxEXPAND and 
proportion flags, and I just cannot make anything happen when the window 
resizes.

What am I doing wrong?

----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

    http://mailnull.com/

Reply via email to