sys13
sys13

Reputation: 148

Centering PopupPanel doesn't work on first call

I'd like PopupPanel centred in the screen calling the center() method. It is placed incorrectly the first time I load it. All subsequent times, it centers just fine.

It seems like the styles contained in < ui:style> aren't being injected. I've tried creating an interface to the style in the View (per GWT docs) and calling ensureInjected() in the constructor but this has no effect.

How to have consistent centering?

Upvotes: 0

Views: 871

Answers (2)

There is a defect which is said to be fixed in GWT 2.5. For me the issue still exists in 2.5, and for my situation the fix was to set width and height of the panel explicitly:

popup.setWidth("800px");
popup.setHeight("700px");

Upvotes: 3

Chris Lercher
Chris Lercher

Reputation: 37778

For me, this works with the following simple snippet (tested on Firefox 3.6 and Chrome 10.0):

@Override
public void onModuleLoad() {

    final PopupPanel popupPanel = new PopupPanel();
    popupPanel.center();
}

Are you doing something differently?

Upvotes: 0

Related Questions