开发者

How to 'shake' a window in qooxdoo?

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).


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. ;-)


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);


var win = new qx.ui.window.Window("Login");
win.setLayout(new qx.ui.layout.Grow);
win.add(view);
win.addListener("appear", function(){
  var effect = new qx.fx.effect.combination.Shake(win.getContainerElement().getDomElement());
  effect.start();
}, this);
return win;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜