Not stretching vertically

I’m using wxRuby 2.0.1 on a PCLinuxOS system

I have a form with a horizontal sizer. The form was built by
wsFormBuilder if that matters. The sizer’s proportion is set to 1.

There are two controls in the sizer. On the left is a listbox with
proportion of 1. On the right is a textbox with proportion 2. By use of
the minimum size, both boxes start off with correct sizes.

When I stretch the form, however, the two controls stretch as desired in
the horizontal direction, but the veritcal sizes don’t change at all.
This creates a very ugly space beneath the controls (and above another
horizontal sizer that has the control buttons in it … that sizer has a
proportion of 0 and doesn’t stretch - again, as desired.

I’m obviously missing something. What do I need to do to get the
controls to stretch in the vertical direction as well as the horizontal?

As always, thanks in advance
—Michael

Hello Michael,

What you need to do, is in wxFormBuilder, you need to ensure that under
Sizer Properties for the sizer in question, you have wxGROW and wxEXPAND
checked, in order for both vertical and horizontal growth to occur when
re-sizing the main form. Otherwise, it will only follow the rules given
to
it by a wxSizer of whatever direction you choose.

hth,

Mario

On Sun, Aug 22, 2010 at 10:33 AM, Michael S.

Mario S. wrote:

Hello Michael,

What you need to do, is in wxFormBuilder, you need to ensure that under
Sizer Properties for the sizer in question, you have wxGROW and wxEXPAND
checked, in order for both vertical and horizontal growth to occur when
re-sizing the main form. Otherwise, it will only follow the rules given
to
it by a wxSizer of whatever direction you choose.

I’m looking at the sizer in wxFormBuilder right now. I see wxExpand -
and it is checked. I don’t see a wxGrow ANYWHERE in the properties.

Michael S. wrote:

I’m looking at the sizer in wxFormBuilder right now. I see wxExpand -
and it is checked. I don’t see a wxGrow ANYWHERE in the properties.

Wx::GROW is just a (less frequently used) synonym for Wx::EXPAND.

But Wx::EXPAND (or in C++/xrc, wxExpand) is definitely what you want, as
Mario says. The proportion argument controls sizing in the main (in this
case horizontal) dimension. Wx::EXPAND means it should fill the space in
the other dimension.

If that’s not working, check that the sizer itself is really getting the
space you think it is - have a look at the boundaries in XRC designer -
these should be an accurate reflection of what it will look like. If
that doesn’t help, please post a minimal snippet that reproduces the
problem.

a

Got it - and, of course, I had missed something that should have been
obvious. I had the sizers set up correctly. I hadn’t checked wxExpand in
the controls, though.

I want to thank those who replied. Your feedback got me looking in the
right direction. I appreciate the help!

—Michael

That is what we are here for Michael. Glad that it worked, and helped
you
find the problem.

Mario

On Mon, Aug 23, 2010 at 10:45 AM, Michael S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs