目前为止,我们可以看一下Atlas控件中textbox的具体实现。看看textbox中是如何在相应的HTML事件发出时同样发出propertyChanged事件的。
var_text;
var_changeHandler;
this.get_text=function(){
returnthis.element.value;
}
this.set_text=function(value){
if(this.element.value!=value){
this.element.value=value;
this.raisePropertyChanged('text');
}
}
this.initialize=function(){
Sys.UI.TextBox.callBaseMethod(this,'initialize');
_text=this.element.value;
_changeHandler=Function.createDelegate(this,this._onChanged);
this.element.attachEvent('onchange',_changeHandler);
_keyPressHandler=Function.createDelegate(this,this._onKeyPress);
this.element.attachEvent('onkeypress',_keyPressHandler);
}
this._onChanged=function(){
if(this.element.value!=_text){
_text=this.element.value;
this.raisePropertyChanged('text');
}
}
| 对此文章发表了评论 |

