Tuesday, January 28, 2014

Re: Dialogbox.center and resize synchronization problem

You might want to play with setPopupPositionAndShow(); there's an example at the top of this page:

http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/PopupPanel.html

Just as an example (YMMV), I use this in some of my DialogBox objects:

    public void center(boolean p_touch)

    {

        if (p_touch)

        {

            setPopupPositionAndShow(new PositionCallback()

            {

                @Override

                public void setPosition(int offsetWidth, int offsetHeight)

                {

                    int left = (Browser.getWindowInnerWidth() - offsetWidth) >> 1;

                    int top = (Browser.getWindowInnerHeight() - offsetHeight) >> 1;


                    left = Math.max(Window.getScrollLeft() + left, 0);

                    top = Math.max(Window.getScrollTop() + top, 0);


                    setPopupPosition(left, top);

                }

            });

        }

        else

        {

            super.center();

        }

    }


On Tuesday, January 28, 2014 8:31:11 AM UTC-8, Magnus wrote:
Hi,

I have a Dialogbox with a CellTable. The constructor creates the table which causes an onRangeChange event, which in turn causes a RPC call to fetch a list of table entries. When this call returns the table is filled and thus, the size of the dialog box increases.

However, the center method will place the dialog box at the wrong position, no matter where it is called. The box is positioned too far to the right and too far to the bottom - as if the table was still empty.

I also tried to place the center call right after the call to the AsyncDataProvider's updateRowData call, even as a scheduled (deferred) call. No success...

What can I do?

Thanks
Magnus

--
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.

No comments:

Post a Comment