PDA

View Full Version : [FIXED] Dialog - setting size before show doesn't work on second call



plitvak
17 Jun 2008, 2:21 PM
Here is the code:


final Dialog testD = new Dialog()
{
{
this.setButtons( Dialog.OKCANCEL );
this.setHideOnButtonClick( true );
this.setHeading( "Test" );
}

@Override
protected void onRender( Element parent, int pos )
{
super.onRender( parent, pos );

this.setLayout( new FitLayout() );

LayoutContainer lc = new LayoutContainer();
lc.setLayout( new RowLayout() { {this.monitorResize = true;} } );

DataList dl = new DataList();

for( int i = 0; i < 50; i++ ) {
dl.add( new DataListItem("_"+i) );
}

lc.add( new TextBox(), new RowData( 1, Style.DEFAULT ) );
lc.add( dl, new RowData( 1, 1 ) );

this.add( lc );
}
};

Button bt = new Button( "Show" );
bt.addSelectionListener( new SelectionListener<ComponentEvent>(){
public void componentSelected( ComponentEvent ce ) {
testD.setWidth( 240 );
testD.setHeight( 280 );
testD.show();
}
} );
First click on button is fine, second shows broken UI but if you resize the dialog it fixes itself.

darrellmeyer
17 Jun 2008, 8:18 PM
Fix is in SVN.

plitvak
18 Jun 2008, 3:43 AM
Thanks!