# Problem with ListBox height

**URL:** <https://www.ruby-forum.com/t/problem-with-listbox-height/164298>\
**Category:** wxRuby\
**Created:** [March 31, 2009, 12:47am UTC](https://www.ruby-forum.com/t/problem-with-listbox-height/164298 "2009-03-31T00:47:49Z")\
**Posts on this page:** 3\
**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:** [March 31, 2009, 12:47am UTC](https://www.ruby-forum.com/t/problem-with-listbox-height/164298/1 "2009-03-31T00:47:49Z")

</div>

I have a Wx::ListBox control in a BoxSizer in a dialog. I’m using the  
Wx::GROW option for the box. The ListBox is properly sizing to the  
WIDTH of the sizer, but it isn’t sizing vertically at all.  
Initially, the ListBox has no items in it (the contents of the box is  
under control of the user). Even with no items, I want to see it sized  
vertically to the allocated size. The fact that it is empty (or only has  
2 or three items) shouldn’t inhibit its vertical size.

Can anyone offer any 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:** [March 31, 2009, 8:30am UTC](https://www.ruby-forum.com/t/problem-with-listbox-height/164298/2 "2009-03-31T08:30:42Z")

</div>

Michael S. wrote:

> I have a Wx::ListBox control in a BoxSizer in a dialog. I’m using the  
> Wx::GROW option for the box. The ListBox is properly sizing to the  
> WIDTH of the sizer, but it isn’t sizing vertically at all.  
> Initially, the ListBox has no items in it (the contents of the box is  
> under control of the user). Even with no items, I want to see it sized  
> vertically to the allocated size. The fact that it is empty (or only has  
> 2 or three items) shouldn’t inhibit its vertical size.

Give a non-zero proportion argument to Sizer#add - this tells the Sizer  
how much of the main dimension (eg vertical) to allocate to that widget.

hth  
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:** [March 31, 2009, 6:44pm UTC](https://www.ruby-forum.com/t/problem-with-listbox-height/164298/3 "2009-03-31T18:44:16Z")

</div>

On Tuesday 31 March 2009 01:28:38 am Alex F. wrote:

> Give a non-zero proportion argument to Sizer#add - this tells the Sizer  
> how much of the main dimension (eg vertical) to allocate to that widget.

Thank you very much. I’m still learning wxruby / wxwidgets. I appreciate  
the  
help!

----Michael
