Saturday, October 5, 2013

Re: how to get the width & height of dialog box (also calculate the actual size of dialog when it was shown) in GWT?

I usually set the width and height of the contained widget explicitly  and just use the DialogBox or PopupPanel as a wrapper.  I use the following extended version of Popup panel to size the popup at 75% width and 60% height of the current window.  Basically, resizing the widget and not the dialogbox.   

public class YourAppWidgetPopupPanel extends PopupPanel {


public YourAppWidgetPopupPanel() {

super(true);

setAnimationEnabled(true);

setAutoHideEnabled(true);

setGlassEnabled(true);

}


@Override

public void setWidget(Widget widget) {

super.setWidget(widget);

int height = RootLayoutPanel.get().getOffsetHeight();

int width = RootLayoutPanel.get().getOffsetWidth();

int w = width * 3 / 4;

int h = height * 3 / 5;

widget.setWidth(w + "px");

widget.setHeight(h + "px");

center();

}


public YourAppWidgetPopupPanel(boolean autoHide) {

super(autoHide);

}


public YourAppWidgetPopupPanel(boolean autoHide, boolean modal) {

super(autoHide, modal);

}


}




On Friday, October 4, 2013 9:18:13 AM UTC-7, Tom wrote:
I have a dialogbox holding a HTMLPanel that has a flextable & 2 buttons.

So I tried myDialog.getOffsetWidth & myDialog.getOffsetHeight, it showed some result but somehow it doesn't count the size of the widgets inside HTMLPanel inside DialogBox.

how to get the width & height of dialog box (also calculate the actual size of dialog when it was shown) in GWT?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate