Forum: wxRuby FlexibleGrid column sizing

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Michael M. (Guest)
on 2009-04-19 05:09
OK, I'm relatively new to wxruby, but have gotten a few forms
successful, and so building up some experience, but have run into a
major challenge with the following issue.  I want to generate a
table-like thing, that has a known number of columns, but a variable
number of rows, but the number of rows will be 25 or less; all the rows
are to be the same height, but the columns need to be all different

So I was using a FlexGridSizer, set the number of columns and rows; I am
able to put the sizer into a form and able to put controls into the
FlexGrid control without any proble.  However all the columns are the
same width, and I can't find any combination of flags that will make the
the columns anything other than the width of the widest column.  Most of
the controls going into the grid are TextCtrls and I have specified the
"maximum_size" attribute as a,-1) with the following flags:
ALIGN_LEFT  | ST_NO_AUTORESIZE.  When adding the controls to the
FlexGrid to "proportion" field is set to zero.  And yet all the columns
are the same width, the width of the widest sub-control.

How can one specify a maximum column size?  How does one have a FlexGrid
recompute the column widths?  Is FlexGrid the wrong thing to do this
Alex F. (Guest)
on 2009-04-20 02:45
(Received via mailing list)

Michael M. wrote:
> FlexGrid control without any proble.  However all the columns are the
> with?

You probably want to call FlexGridSizer#add_growable_col with a
proportion > 0 on at least one column in the sizer. That column will
then receive available additional space, and the other columns will have
the minimum size for their controls.

If all proportions == 0, the available space is distributed evenly
between all columns:

This topic is locked and can not be replied to.