Hi,

just add a "resize"-Listener to the windows parent. Here is a example (works in 
playground):

var win = new qx.ui.window.Window("Login");     
win.setLayout(new qx.ui.layout.VBox(10));
win.setShowStatusbar(true);
win.setStatus("Please enter your username and password");
win.setShowMinimize(false);
win.setShowMaximize(false);
win.setModal(true);
win.setMovable(false);
win.setShowClose(false);
win.addListener("resize", win.center);
this.getRoot().addListener("resize", win.center, win); //"this" in center has 
to be the window (third parameter).
this.getRoot().add(win);
win.open();

You have to make sure that "this" in the center method of the window refers to 
the window. Maybe a better way is to write the listener function like this:

this.getRoot().addListener("resize", function(e) {
  win.center();
});

Regards,
Andreas

-----Ursprüngliche Nachricht-----
Von: skar [mailto:[email protected]] 
Gesendet: Freitag, 17. Juli 2009 09:05
An: [email protected]
Betreff: [qooxdoo-devel] centering a window

Hi,

I'm using qooxdoo 0.8.2 with the following code:

main: function()
    {
      this.base(arguments);
      var win = new qx.ui.window.Window("Login");
      win.setLayout(new qx.ui.layout.VBox(10));
      win.setShowStatusbar(true);
      win.setStatus("Please enter your username and password");
      win.setShowMinimize(false);
      win.setShowMaximize(false);
      win.setModal(true);
      win.setMovable(false);
      win.setShowClose(false);
      win.addListener("resize", win.center);
      win.addListener("resize", win.center);

      win.open();
      this.getRoot().add(win);     

    }

The login window gets centered when the page is first rendered. But when
I resize the browser, it doesn't get centered again.

Regards,
Karthikeyan, S.

-- 
--
The life so short, the craft so long to learn. 


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to