Hi,

I don't know if your "dialog.Login" class is derived from
"qx.ui.window.Window"...
But if it is, the code (see below) works fine for me

Cheers,
  Peter

On 2011-02-03 19:04 bplturner wrote:
> 
> Hello,
> 
> I'm using the Dialog contribution to create a login window, but I cannot get
> the thing to center in the page and it's frustrating me.  I changed the
> image to a slightly bigger one, and if I resize the page it'll center, but
> it won't center when I initially render it.
> 
> Here is my code:
> 
> createLogin : function()
>   {
>     var loginWidget = new dialog.Login({
>       image       : "foo_small.gif", 
>       text        : "Welcome to Foofoo..",
>       callback    : this.loginCallbackFunc,
>       context     : this,
>       maxWidth    : 600
>     });
>     loginWidget.addListener("loginSuccess", function(e){
>       dialog.Dialog.alert( "You are now logged in. Or at least we pretend."
> );
>     });
>     loginWidget.addListener("loginFailure", function(e){
>       dialog.Dialog.alert(e.getData());
>     });
>     var self = this;
>     loginWidget.addListener("registerRequest", function(e) {
>       self.registerWizard();
>     });


    // Center this window on screen as proposed here:
    // http://qooxdoo.org/documentation/1.0/snippets#center_a_window_on_screen
    loginWidget.addListenerOnce("resize", this.center, loginWidget);

I think you can remove the following block, then:
------------8<--- snip ----8<-------------------------
>     qx.ui.core.queue.Manager.flush();
>     loginWidget.setAlignX("center");
>     loginWidget.setAlignY("center");
>     var bounds = loginWidget.getBounds();
>     loginWidget.set({
>       marginTop: Math.round( ( qx.bom.Document.getHeight() -bounds.height )
> / 2),
>       marginLeft : Math.round( ( qx.bom.Document.getWidth() -bounds.width) /
> 2)
>     });
>     
------------8<--- snap ----8<-------------------------

>     loginWidget.show();
>   },
> 
> I tried setAlign and also by setting the margins manually, but that doesn't
> work.  I tried loginWidget.center() but that's not supported.  Can anyone
> assist?  It's about 100 pixels off from center and it's driving me nuts. 
> Thank you.
> 
> It's invoked with a simple createLogin(); from the main function.

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to