# Control Sizing

**URL:** <https://www.ruby-forum.com/t/control-sizing/165881>\
**Category:** wxRuby\
**Created:** [April 18, 2009, 8:40pm UTC](https://www.ruby-forum.com/t/control-sizing/165881 "2009-04-18T20:40:00Z")\
**Posts on this page:** 2\
**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:** [April 18, 2009, 8:40pm UTC](https://www.ruby-forum.com/t/control-sizing/165881/1 "2009-04-18T20:40:00Z")

</div>

I’m still having trouble getting the intricities of Control sizing  
through my head.

I’m using wxFormBuilder to build my screen, but I can subclass and write  
code as needed … if I knew what code is needed.

I have a form with a vertical sizer that contains a label and a ListBox  
control. The label has a proportion of 0, the listbox of 1. When the  
form is created, the listbox is only tall enough to contain about 3  
items - very short screen. I want it to be tall enough for at least 10  
items. problem: I have no idea how to reasonably control the size of a  
control (in this case listbox)

I am calling self.fit - which I _THINK_ may be the problem. If I don’t  
call that, however, the screen comes up so narrow that the controls on  
the right are cut off - which is much worse than the sort listbox.

Would one of the experts here be so kind as to help me in understanding  
how to control something such as this?

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:** [April 18, 2009, 8:57pm UTC](https://www.ruby-forum.com/t/control-sizing/165881/2 "2009-04-18T20:57:40Z")

</div>

Michael S. wrote:

> I have a form with a vertical sizer that contains a label and a ListBox  
> control. The label has a proportion of 0, the listbox of 1. When the  
> form is created, the listbox is only tall enough to contain about 3  
> items - very short screen. I want it to be tall enough for at least 10  
> items. problem: I have no idea how to reasonably control the size of a  
> control (in this case listbox)
> 
> I am calling self.fit - which I _THINK_ may be the problem. If I don’t  
> call that, however, the screen comes up so narrow that the controls on  
> the right are cut off - which is much worse than the sort listbox.

Perhaps calling something like:

list\_box.min\_size = [250, 400]

(and then possibly, sizer.layout, to update the layout)

Calling this advises the sizer of a minimum size for the relevant widget  
to be allocated in the layout  
[http://wxruby.rubyforge.org/doc/window.html#Window\_setminsize](http://wxruby.rubyforge.org/doc/window.html#Window_setminsize)

alex
