tags:

views:

52

answers:

2

Hi,

I'm trying to shake a window, but got error mess in console. My code:

  var win = new qx.ui.window.Window ("Login");
  win.setLayout (new qx.ui.layout.Grow);
  win.add (view);

  this.effect = new qx.fx.effect.combination.Shake (
    win.getContainerElement ().getDomElement ());

  return win;

Where view is a GroupBox instance (from demobrowser/animation/login).

+2  A: 

Sorry for noise! If I create an effect in "appear" listener - code works well.

    win.addListener ("appear", function (e) 
    {
      this.effect = new qx.fx.effect.combination.Shake (
        win.getContainerElement ().getDomElement ());
    }, this);
W55tKQbuRu28Q4xv
+2  A: 

As you have found out by yourself: the DOM element of the window is not there at the moment you create the shake object. In qooxdoo we create all DOM elements at once, so that the browser don't have to render more often than needed.

At the time window fires the "appear" event (you could also use the "resize" event), the DOM element has been created. Be sure to use addListenerOnce() instead of addListener()! Otherwise you will create a new shake effect every time the window gets visible again, if it has been hidden. ;-)

Jonathan Weiß
Thanks, information about addListenerOnce very useful!
W55tKQbuRu28Q4xv