Tuesday, February 28, 2012

Re: the output of DialogBox is very strange

thanks for the reply.
I found the problem seems related to Dialogbox.setsize(), if call this
method, the dialogBox will be very strange, just try the following to
simulate:

public class GWTTest1 implements EntryPoint, ClickHandler {

private static class MyDialog extends DialogBox {

public MyDialog() {
// Set the dialog box's caption.
setText("My First Dialog");

// Enable animation.
setAnimationEnabled(true);

// Enable glass background.
setGlassEnabled(true);

// DialogBox is a SimplePanel, so you have to set its widget
property to
// whatever you want its contents to be.
ScrollPanel scrollPanel1 = new ScrollPanel();
//scrollPanel1.setSize("1800px", "500px");
setWidget(scrollPanel1);
Button ok = new Button("OK");

ok.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
MyDialog.this.hide();
}
});
scrollPanel1.add(ok);

}
}

public void onModuleLoad() {
Button b = new Button("Click me");
b.addClickHandler(this);

RootPanel.get().add(b);
}

public void onClick(ClickEvent event) {
// Instantiate the dialog box and show it.
MyDialog myDialog1 = new MyDialog();
// if myDialog1.setSize(), will throw very strange result!!
myDialog1.setSize("1800px", "500px");
myDialog1.show();
}
}

if comment out the statement "myDialog1.setSize("1800px", "500px");"
and uncomment the statement //scrollPanel1.setSize("1800px", "500px");
everything is ok.
so I think the DialogBox.setSize() has some problem.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment