|Re: Table Cell and two progress bars [message #1051398 is a reply to message #1050777]
||Sun, 28 April 2013 14:32
Registered: August 2011
Wojtek wrote :|
> You also need a Listener so the cell's height expands to show both bars.
> Still trying to get this to happen when the table is created rather than at
> the first SWT.MeasureItem event.
Well, it's ugly, but as the last line in the fillTable() method:
table.addListener( SWT.MeasureItem, new TablePaintListener() );
private class TablePaintListener implements Listener
public void handleEvent( Event event )
// we use one of the progress bars to get the height
if ( progressBarTop != null )
// set the height to fit two progress bars
// the decimal value is a fudge factor
double newHeight = progressBarTop.getSize().y * 2.64;
event.height = (int) newHeight;
// we only need to do the resize once
ivTable.removeListener( SWT.MeasureItem, this );
What I don't get is why the event affects row height. Presumably it is
fired when the table needs resizing, but how is the event pointing at
the correct widget so that the height adjustment works?
And why do I need the ".64" to correctly set the height? Is the actual
height of a progress bar 1.32 times the reported height? Why?
BTW, the "top" of the top bar is offset "0", and the separation between
the two bars is "0", so I am not adding any extra "y" size.
Powered by FUDForum
. Page generated in 0.02176 seconds