I would like to be able to place the dialog box in the center of the
currently viewable client area, but can't find a way to determine where
the top of the viewport is.
The documentation for Window and PopupPanel state:
PopupPanel: setPopupPosition(int, int) Sets the popup's position
relative to the browser's client area.
Window: getClientHeight() Gets the height of the browser window's
client area.
getClientHeight() always returns the viewport height which seems to
imply that setPopupPosition should position the panel relative to the
viewport as both are called the 'client area', however setPopupPosition
always starts at zero.
any ideas on how to accomplish this?
myBox.setPopupPosition((Window.clientWidth() -
myBox.getOffsetWidth())/2,
(Window.clientHeight() -
myBox.getOffsetHeight())/2);
If you do not specify width and height for your Box then you must do
this after calling show(). This makes the box jump on the screen.
Does anybody have a better solution?