Control Sizing


#1

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


#2

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

alex