Forum: wxRuby FlexibleGrid column sizing

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2114d049eac196b373292ce849b1d4c9?d=identicon&s=25 Michael Mcandrews (zortag)
on 2009-04-19 03: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
widths.

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 Size.new(x,-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
with?
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-04-20 00:45
(Received via mailing list)
Hi

Michael Mcandrews 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:

http://wxruby.rubyforge.org/doc/flexgridsizer.html...

a
This topic is locked and can not be replied to.