qooxdoo

How can I add two icons to button


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


Solution

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