Hi Tom

I guess that's because your addContent Method is called at constructor
time, which is before you actually render the window using "open".

Replace your this.center() call with this line:
this.addListenerOnce("resize", this.center, this);

The resize listener will be fired when you open the window and then
center it correctly.

Cheers - Roman

Thomas Schober wrote:
> Hello Roman,
> 
> that does not work.The center method does nothing. But perhaps something
> is wrong in my application code:
> 
> The Application.js looks like this:
> 
> qx.Class.define("firstapp.Application",
> {
>   extend : qx.application.Standalone,
> 
> 
> 
>   /*
>  
> *****************************************************************************
>      MEMBERS
>  
> *****************************************************************************
>   */
> 
>   members :
>   {
>     /**
>      * This method contains the initial application code and gets called 
>      * during startup of the application
>      */
>     main : function()
>     {
>       // Call super class
>       this.base(arguments);
> 
>       // Enable logging in debug variant
>       if (qx.core.Variant.isSet("qx.debug", "on"))
>       {
>         // support native logging capabilities, e.g. Firebug for Firefox
>         qx.log.appender.Native;
>         // support additional cross-browser console. Press F7 to toggle
> visibility
>         qx.log.appender.Console;
>       }
> 
>       /*
>      
> -------------------------------------------------------------------------
>         Below is your actual application code...
>      
> -------------------------------------------------------------------------
>       */
>       var loginWindow = new firstapp.ui.LoginBox("LoginWindow",null);
>       loginWindow.open();
>     } // End main
>   }//end members
> });// end class
> 
> 
> My loginWindow definition looks like this:
> 
> /* ************************************************************************
> 
>    Copyright:
> 
>    License:
> 
>    Authors:
> 
> ************************************************************************ */
> 
> /* ************************************************************************
> 
> #asset(firstapp/*)
> 
> ************************************************************************ */
> 
> /**
>  * This is the main application class of your custom application "firstapp"
>  */
> qx.Class.define("firstapp.ui.LoginBox",
> {
>   extend : qx.ui.window.Window,
> 
> 
> 
>   /*
>  
> *****************************************************************************
>      MEMBERS
>  
> *****************************************************************************
>   */
>   construct : function(name,icon)
>   {
>     this.base(arguments,name,icon);
>     this.set 
>     ({
>         modal         : true,
>         showMinimize  : false,
>         showMaximize  : false,
>         allowMaximize : false,
>         allowClose    : false
> 
>         
> 
>     });
> 
>     
> 
>     this.addContent();
>   },
> 
>   
> 
>   members :
>   {
>     /**
>      * This method contains the initial application code and gets called 
>      * during startup of the application
>      */
>      addContent : function()
>      {
>         var windowLayout = new qx.ui.layout.VBox(10);
>         this.setLayout(windowLayout);
>         this.setMinWidth(300);
>         var loginField = new qx.ui.form.TextField("Enter
> Login").set({width: 260});
>         var passField = new qx.ui.form.PasswordField("Enter
> Passw").set({width : 260});
>         this.add(loginField);
>         this.add(passField);
>         this.center();
>      }
>   }
> });
> 
> The this.center() has no effect here.
> 
> Regards
> Tom
> 
> Am 17.01.2009 um 16:13 schrieb Roman Schmid:
> 
>> Hi Tom
>>
>> You can simply use the "center" method of the Window class:
>> http://demo.qooxdoo.org/current/apiviewer/#qx.ui.window.Window
>>
>> When i write custom window classes that should be centered, i place the
>> following line in the constructor (or whenever the contents of the
>> windows change):
>> this.addListenerOnce("resize", this.center, this);
>>
>> Cheers - Roman
>>
>>
>> Thomas Schober wrote:
>>> Hi,
>>>
>>> i am developing a Application, inherited from qx.application.Standalone.
>>> Now i want to open a window, which is placed in the center of the
>>> browser window. How can i get the height and width of the underlying
>>> canvas ?
>>>
>>> Thank you
>>> Tom
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> This SF.net email is sponsored by:
>>> SourcForge Community
>>> SourceForge wants to tell your story.
>>> http://p.sf.net/sfu/sf-spreadtheword
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> qooxdoo-devel@lists.sourceforge.net
>>> <mailto:qooxdoo-devel@lists.sourceforge.net>
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by:
>> SourcForge Community
>> SourceForge wants to tell your story.
>> http://p.sf.net/sfu/sf-spreadtheword
>> _______________________________________________
>> qooxdoo-devel mailing list
>> qooxdoo-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to