开发者

How to set Border/Background on CanvasLayout based Custom Widget in Qooxdoo?

I'm new to Qooxdoo (i'm using v开发者_StackOverflow社区ersion 0.7.4, because I'm using Eclipse RAP) and I'm try to create a Custom Widget based on CanvasLayout class, that composites another Widgets. Here little peace of code:

qx.Class.define( "my.CanvasWidget", {
  extend: qx.ui.layout.CanvasLayout,
   construct: function( id ) {
     this.base( arguments );
     ...
   }

    }
  } );


//If using:

var myCanvasWidget = new my.CanvasWidget("myId");
...
myCanvasWidget.setBackgroundColor("#ff0000");

My question is: the setBackgroundColor has no effort on myCanvasWidget, why is it so (The property backgroundColor exist in super Class "Widget")?


It depends on the size of your CanvasLayout widget. Setting the size (height and width) of it will show you the background color.

 // in the constructor of your widget
 this.setWidth(100);  // 100 for example
 this.setHeight(100);

As it is 0.7.x, the size information, as far as I know, will not be calculated automatically so you have to take care of that yourself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜