# Not stretching vertically

**URL:** <https://www.ruby-forum.com/t/not-stretching-vertically/193694>\
**Category:** wxRuby\
**Created:** [August 22, 2010, 4:33pm UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694 "2010-08-22T16:33:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 22, 2010, 4:33pm UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694/1 "2010-08-22T16:33:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 23, 2010, 2:58am UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694/2 "2010-08-23T02:58:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 23, 2010, 4:59am UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694/3 "2010-08-23T04:59:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 23, 2010, 1:33pm UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694/4 "2010-08-23T13:33:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 23, 2010, 4:45pm UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694/5 "2010-08-23T16:45:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [August 24, 2010, 7:17am UTC](https://www.ruby-forum.com/t/not-stretching-vertically/193694/6 "2010-08-24T07:17:10Z")

</div>

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.
