Reputation: 39
I want to create a button with two icons. One at the left edge and at the right edge. How can I do it?
example: https://archive.qooxdoo.org/current/playground/#Hello%20World-ria
Upvotes: 1
Views: 128
Reputation: 616
Alternatively, you can take advantage of the fact that every widget is in essence a container. You can call the button's _add
method, as shown here:
var button1 =
new qx.ui.form.Button("First Button", "icon/22/apps/internet-web-browser.png");
// Add another icon. It'll be added after whatever has already been
// added to the button, which is the original icon and the button text.
button1._add(new qx.ui.basic.Image("icon/22/apps/internet-web-browser.png"));
Upvotes: 1
Reputation: 460
The idea is to redefine _createChildControlImpl
method and create the second icon there:
qx.Class.define("myapp.Button", {
extend : qx.ui.form.Button,
construct(name, path){
this.base(arguments, name, path);
this._createChildControl("secondicon");
},
members: {
_createChildControlImpl(id, hash){
let control;
switch(id) {
case "secondicon":
control = new qx.ui.basic.Image(this.getIcon());
this._add(control);
break;
}
return control || super._createChildControlImpl(id);
}
}
});
Upvotes: 1