Yeah I'm not exactly sure what is causing it, doesn't seem to be that
PopupPanel.center() is broken outright. I tried playing around with
the code to see if I pin point the bug but wasn't able to. I'm using
GWT 1.7 though.

For those interested though here is the full code for a work around:

private void center() {
    popup.setPopupPositionAndShow(new PositionCallback() {
    @Override
        public void setPosition(int offsetWidth, int offsetHeight) a {
            int[] winSize = windowSize();
            int left = (winSize[0] - offsetWidth) >> 1;
            int top = (winSize[1] - offsetHeight) >> 1;
            popup.setPopupPosition(Window.getScrollLeft() + left,
                    Window.getScrollTop() + top);
        }
    });
}

private final native int[] windowSize() /*-{
    var myWidth = 0, myHeight = 0;
    if (typeof($wnd.innerWidth) == 'number') {
        //Non-IE
        myWidth = $wnd.innerWidth;
        myHeight = $wnd.innerHeight;
    } else if ($doc.documentElement &&
        ($doc.documentElement.clientWidth ||
        $doc.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = $doc.documentElement.clientWidth;
        myHeight = $doc.documentElement.clientHeight;
    } else if ($doc.body && ($doc.body.clientWidth ||
            $doc.body.clientHeight)) {
        //IE 4 compatible
        myWidth = $doc.body.clientWidth;
        myHeight = $doc.body.clientHeight;
    }
    return [myWidth, myHeight];
}-*/;

On Dec 9, 1:53 am, Thomas Broyer <[email protected]> wrote:
> On Nov 30, 11:37 am, Thomas Broyer <[email protected]> wrote:
>
>
>
> > (and I agree PopupPanel.center() should use window.innerHeight/Width
> > where possible; at least when the document is smaller than the window;
> > have you filed a bug?)
>
> I just changed some popups (DialogBox) from setPosition+show tocenter
> () and they display correctly in FF3.5, even when the document is
> smaller than the window.
> The page is in "standards mode", in case it changes something (which I
> believe it could). And I'm using GWT 2.0 RC2 (I'm setting
> setGlassEnabled(true) and the glass correctly overlays everything: the
> whole viewport when the document is small than the window, or the
> whole document when there's a scrollbar)

--

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


Reply via email to