1

我是 Qooxdoo 的新手(我使用的是 0.7.4 版,因为我使用的是 Eclipse RAP)并且我正在尝试创建一个基于 CanvasLayout 类的自定义小部件,它组合了另一个小部件。这里有点和平的代码:

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

我的问题是: setBackgroundColor 对 myCanvasWidget 没有任何努力,为什么会这样(属性 backgroundColor 存在于超类“Widget”中)?

4

1 回答 1

0

这取决于 CanvasLayout 小部件的大小。设置它的大小(高度和宽度)将显示背景颜色。

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

由于它是 0.7.x,据我所知,大小信息不会自动计算,因此您必须自己处理。

于 2010-02-10T07:23:57.433 回答