[fxruby-users] a table column that fills horizontally

Joel VanderWerf vjoel at path.berkeley.edu
Sat May 19 21:02:41 EDT 2007

Is there a way to specify that a table column should resize itself to 
fill available space, so that it is just big enough that there is no 
unused space in the table, but there is no horizontal scroll bar?

That might be too special a situation for FXTable in general to handle, 
but anyway here's a way to do it (tested a little). The +fill+ variable 
is the column number of the column that should adjust its width.

         fill_resizer = proc do
           other_width = table.verticalScrollBar.width +
             table.rowHeaderWidth +
             (0...columns.size).inject(0){|sum,c| sum +
               (c == fill ? 0 : table.getColumnWidth(c))}
           table.setColumnWidth fill, table.width - other_width - 1
         table.connect(SEL_CONFIGURE, &fill_resizer)
         table.columnHeader.connect(SEL_CHANGED, &fill_resizer)

       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

More information about the fxruby-users mailing list