btn = new AW.System.Control;
with(btn)
{
setId("myButton");
setTag("button");
setContent("html", "button text");
setAttribute("disabled", "disabled");
}
var live_button = 1;
var bobj1 = new AW.UI.Button;
bobj1.setId("myButton1"); // necessary for CSS rules
bobj1.setControlText("New");
document.write(bobj1);
var bobj2 = new AW.UI.Button;
bobj2.setId("myButton2"); // necessary for CSS rules
bobj2.setControlText("Update");
document.write(bobj2);
bobj1.onClick = function(text){
live_button = 0;
bobj2.setStyle("color", "red");
};
bobj2.onClick = function(text){
if(live_button){
alert("alive");
}
};
live_button = 1;
bobj2.setStyle("color", "black");
Button = AW.UI.Button.subclass();
Button.create = function() {
var obj = this.prototype;
obj.init = function() {
var _handleDisabled = function() {
if (this._disabled) return true;
}
this.setController("disabled", {
onControlClicked: _handleDisabled
});
this._controllers.unshift(this._controllers.pop());
}
obj.disable = function(value) {
if (!this._disabled && value) {
// now disabled
this._disabled = true;
this.setAttribute("awx", null);
this.setAttribute("disabled", true);
} else if (this._disabled && !isDisabled) {
// now enabled
this._disabled = false;
this.setAttribute("awx", "button");
this.setAttribute("disabled", null);
}
}
obj.isDisabled = function() {
return this._disabled;
}
obj._disabled = false;
}
Button = AW.UI.Button.subclass();
Button.create = function() {
var obj = this.prototype;
var UNDEFINED;
obj.init = function() {
var _handleDisabled = function() {
if (this._disabled) return true;
}
// disable events
this.setController("disabled", {
onControlClicked: _handleDisabled
});
// set disable controller to top precedence
this._controllers.unshift(this._controllers.pop());
}
obj.disable = function(value) {
if (!this._disabled && value) {
// now disabled
this._disabled = true;
this.setAttribute("awx", UNDEFINED);
this.setAttribute("disabled", true);
} else if (this._disabled && !value) {
// now enabled
this._disabled = false;
this.setAttribute("awx", "button");
this.setAttribute("disabled", UNDEFINED);
}
this.refresh();
}
obj.isDisabled = function() {
return this._disabled;
}
obj._disabled = false;
}
cancel_button.disable(true)
This topic is archived.