gwt Popup is not centered

590 views
Skip to first unread message

mariyan nenchev

unread,
Mar 12, 2010, 10:04:35 AM3/12/10
to Google Web Toolkit
Hi,

I use gwt popup to show some messages, but it is not displayed in the center of the display event if i call popup.center(). Actually it is not centered only the first time, if i close it and open it again every thing is ok, but not the first time. How to fix that?

Regards.

rudolf michael

unread,
Mar 12, 2010, 10:07:41 AM3/12/10
to google-we...@googlegroups.com
try to set the pixel size of the popup before centering it.
popup.setPixelSize(width, height);

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

mariyan nenchev

unread,
Mar 12, 2010, 10:13:26 AM3/12/10
to google-we...@googlegroups.com
Well i am setting pixel size on the Panel inside the popup

Jim Douglas

unread,
Mar 12, 2010, 12:07:34 PM3/12/10
to Google Web Toolkit
Have you reviewed the sample -- with detailed comments -- near the top
of the javadoc page?

http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/user/client/ui/PopupPanel.html

RPB

unread,
Mar 15, 2010, 6:25:09 AM3/15/10
to Google Web Toolkit
Hi mariyan,
Did you manage to resolve this issue? I see the exact same behaviour
on my application - the popup is not centered for the first time only,
and afterwards popup.center() works fine. I am using GWT 2.0.3. Here
is some sample code - I really can't see why this is happening.
Thanks in advance.

public class LoginForm extends PopupPanel {
public LoginForm(){
this.setStyleName("bwPopupPanel");
this.setGlassEnabled(true);
this.add(new LoginFields()); //LoginFields is a class defined using
UIBinder to position the layout contained in the popup
this.center();
}
}

//..........Different class..........
private void showLoginPopUp() {
@SuppressWarnings("unused")
LoginForm loginPanel = new LoginForm();
}


On Mar 12, 5:07 pm, Jim Douglas <jdoug...@basis.com> wrote:
> Have you reviewed the sample -- with detailed comments -- near the top
> of the javadoc page?
>

> http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/g...

mariyan nenchev

unread,
Mar 15, 2010, 6:37:31 AM3/15/10
to google-we...@googlegroups.com
No, i did not.

Dan

unread,
Mar 15, 2010, 9:12:17 AM3/15/10
to Google Web Toolkit
Put the panel and everything else that goes into it in before doing
center and show.

On Mar 15, 6:37 am, mariyan nenchev <nenchev.mari...@gmail.com> wrote:
> No, i did not.

Paul Stockley

unread,
Mar 15, 2010, 10:36:38 AM3/15/10
to Google Web Toolkit
First, the only reliable way to set the size of the dialog is to set
the width and height of the first container widget you add to the
dialog. Don't try setting width and height on the dialog box, it
doesn't work and there is a bug logged against this.

Secondly, make sure you don't have a style defined such as

.gwt-DialogBox {
width: 350px;
}

In your main .css file. If you do, remove it. The starter GWT
application usually defines this.

If you do these two things it should work OK. You only need to call
center(), not center then show().

Reply all
Reply to author
Forward
0 new messages