Did you try calling center() after the constructor, for example right after where you instantiate the PopupPanel without the center() inside the constructor?
I'm not that deep into GWT core but maybe it's related to the fact that elements get their real/actual dimensions (and these are needed to calculate the center position) only after being completely attached to the DOM. Maybe this is not the case from within the constructor. You can observe this behavior with a Panel. Set its pixel size but don't add it to the RootPanel or any other Panel. Calling getOffsetHeight/Width will not return the expected values until the Panel is attached. On 28 Jun., 15:32, RPB <[email protected]> wrote: > I see the exact same behaviour in my application, and would appreciate > any ideas with this issue. > 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: > > public class LoginForm extends PopupPanel { > public LoginForm(){ > this.setStyleName("bwPopupPanel"); > this.setGlassEnabled(true); > this.add(new LoginFields()); > this.center(); > } > > } > > //..........Different class.......... > private void showLoginPopUp() { > @SuppressWarnings("unused") > LoginForm loginPanel = new LoginForm(); > } > > Any thoughts? > > On Jun 27, 9:06 pm, "Ricardo.M" <[email protected]> wrote: > > > > > Hi, > > > I use gwtpopupto show some messages, but it isnotdisplayed in thecenterof > > the display event if i callpopup.center(). Actually it isnotcentered > > only the first time, if i close it and open it again every thing is > > ok, > > butnotthe first time. How to fix that? > > > I tried using .setPopupPosition(350, 250); but thepopupisnot > > centered only the first time. > > > Regards. -- 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.
