Set popup-window-size corresponding to window-size
I have an gwt-ext window (used as a popup), 开发者_开发百科this popup is launched from a GWT application. I´m searching for a solution to set the window-size of the popup to a size, that it nearly fills the screen, not maximize, but to fill the area of an underlying part of the GWT application that launched this popup. Does anybody know a solution for that problem?
Try something like this:
int windowHeight=Window.getClientHeight()-10; //I subtract 10 from the client height so the window isn't maximized.
int windowWidth=Window.getClientWidth()-10; //I subtract 10 from the client width so the window isn't maximized.
yourExtGwtWindow.setHeight(windowHeight);
yourExtGwtWindow.setWidth(windowWidth);
This will size to the screen size (not the current browser size)
yourExtGwtWindow.setHeight(screenHeight());
yourExtGwtWindow.setWidth(screenWidth());
...
public static native int screenWidth()
/*-{
return screen.availWidth;
}-*/;
public static native int screenHeight()
/*-{
return screen.availHeight;
}-*/;
精彩评论