layout - Two SWT tables fighting to grab space -
i have 2 swt tables wrapped in group, has scrolledcomposite prevent browser scroll bars (and instead scroll table).
table_sizing_toolinfo = new table(grpcapacityreport, swt.border); table_sizing_toolinfo.setdata( rwt.fixed_columns, integer.valueof(6)); table_sizing_toolinfo.setlayoutdata(new griddata(swt.fill, swt.fill, true, true)); both tables have griddata grabs excess vertical space.
when rendering no data tables work expected (both have grab excess, , split view space). once data populated tables, still displays expected, until switching tabs (forcing redraw).
table_sizing_dgrinfo.setredraw(false); table_sizing_toolinfo.setredraw(false); table_sizing_dgrinfo.removeall(); table_sizing_toolinfo.removeall(); while (table_sizing_dgrinfo.getcolumncount() > 6 ) { table_sizing_dgrinfo.getcolumns()[6].dispose(); } while (table_sizing_toolinfo.getcolumncount() > 6 ) { table_sizing_toolinfo.getcolumns()[6].dispose(); } rendersizingtabledynamic(scenariomap.get(combo_sizing_scenarioid.gettext())); table_sizing_toolinfo.setredraw(true); table_sizing_dgrinfo.setredraw(true); the bottom table holds more data top table , more rows added bottom table swallows top table's space until single pixle tall.
the scrolledcomposite unlikely serve needs here. if want both tables take same height, should use rowlayout this:
parent.setlayout( new rowlayout( swt.vertical ) ); table toptable = new table( parent, ... ); table bottomtable = new table( parent, ... ); you use sashform parent of both tables. letting user drag sash separates tables , decide how height each table should take.
for further information, article understanding swt layouts provides in-depth discussion of swt standard layouts. can safely disregard deprecation warning, concepts discussed there stil valid.
Comments
Post a Comment