You can center only rendered windows.
Use this to center window in your constructor
this.addListener("appear", this.center, this);
Ian Horst
Glyn Bowden wrote:
> Hi,
>
> Im new to qooxdoo and so have a newbie question. Im writing an
> application that needs a login to access. Im doing this via a modal
> window. So far so good. However, its the first modal window to be opened
> as soon as the application starts. The issue is that when I call the
> open the DOM doesn’t appear to be ready so the window appears top left
> all the time. If I add an event to a button to call the center on the
> window, that works fine, but not when the window is first opened.
>
> As a side note Im also trying to darken the background behind the modal
> window. Im trying to do that using blockerOpacity and blockerColor. I
> have no idea if that is correct, but its not working anyway. I also
> tried setting the Opacity of root to 0.5 which did fade everything,
> including my window which I couldn’t override.
>
> Any pointers where to get this info or where to start making changes
> would be greatly appreciated.
>
> I have included my windows class source for completeness.
>
> Thanks in advance
>
> Glyn
>
> qx.Class.define("petabytes.view.LoginWindow",
> {
> extend : qx.ui.window.Window,
>
> construct : function()
> {
> this.base(arguments, this.tr("Login"),
> "icon/16/actions/document-new.png");
> this.set(
> {
> modal : true,
> showMinimize : false,
> showMaximize : false,
> allowMaximize : false,
> allowClose : false,
> showClose : false,
> contentPadding : 20,
> blockerColor : '#888888',
> blockerOpacity : 0.5
> });
>
> this._addContent();
> this.center();
>
> },
>
> members :
> {
> _addContent : function()
> {
> this.setLayout(new qx.ui.layout.VBox(10));
>
> var groupBox = new qx.ui.groupbox.GroupBox(this.tr("Login"));
> this.add(groupBox);
>
> var layout = new qx.ui.layout.Grid();
> layout.setSpacing(10);
> groupBox.setLayout(layout);
>
> var userLabel = new qx.ui.basic.Label(this.tr("Username:"));
> var userTextfield = this._userTextfield = new qx.ui.form.TextField();
>
> var passwordLabel = new qx.ui.basic.Label(this.tr("Password:"));
> var passwordField = this._passwordField = new
> qx.ui.form.PasswordField();
>
> groupBox.add(userLabel, {row: 0, column: 0});
> groupBox.add(userTextfield, {row: 0, column: 1});
> groupBox.add(passwordLabel, {row: 1, column: 0});
> groupBox.add(passwordField, {row: 1, column: 1});
>
> userTextfield.setWidth(200);
> passwordField.setWidth(200);
>
> var loginButton = new qx.ui.form.Button(this.tr("Login"),
> "icon/16/actions/dialog-apply.png");
> loginButton.set({
> alignX : "right",
> allowGrowX : false
> });
>
> this.add(loginButton);
> loginButton.addListener("execute", this._loginUser, this);
> },
>
> _loginUser : function(e)
> {
> this.center();
> var username = this._userTextfield.getValue();
> if (username == "")
> {
> alert(this.tr("Please enter a username."));
> return;
> }
>
> var password = this._passwordField.getValue();
> if (password == "")
> {
> alert(this.tr("Please enter a password."));
> return;
> }
>
> this.close();
> }
> }
> });
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel