Onion.widget.Button = function(jwin, parent, controlid) {
    Onion.widget.Control.apply(this, arguments);
}

Onion.widget.Button.prototype = new Onion.widget.Control();

Onion.widget.Button.prototype.create = function(data) {
    var controlid = "ctrl"+this.controlid;
    this.jwin.factory.append('<button id="' + controlid + '">' + data.text + "</button>")
    this.control = $("#"+controlid);
    this.control.addClass(this.cssclass);
    this.handle_click = false;

    var self=this;
    this.control.click(function() { self.clicked(); self.jwin.flush(); });
    this.set_properties(data);
}

Onion.widget.Button.prototype.clicked = function() {
    if(this.handle_click) {
        this.jwin.add_task("event", "click", this.controlid);
    }
}

// register
Onion.widget.register("button", Onion.widget.Button);

@@ -744,16 +744,139 @@
    %7D%0A%7D%0A%0A
+Onion.widget.Button.prototype.update = function(data) %7B%0A    if(data.text) %7B%0A        this.control.html(data.text);%0A    %7D%0A%7D%0A%0A
 // regis

allow button text to be updated