本文介绍了gwt文本框添加更改处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个来自designer的文本框,但是我在GWT中写了一个动作。
问题是文本框是空的,但是当按下按钮填充文本框的值时,将显示警告框,通知该值已更改。
但没有working.help我。
i have a textbox received from designer.but i wrote action in GWT.the problem is textbox is empty but when textbox is filled by value by pressing button then alert box will be displayed informed that value has been changed.but not worked.help me.
TextBox zip1 = null;
function onModuleLoad() {
zip1 = TextBox.wrap(DOM.getElementById("zip1"));
zip1.addChangeHandler(zip1ChangeAction());
}
private ChangeHandler zip1ChangeAction() {
return new ChangeHandler() {
public void onChange(ChangeEvent event) {
Window.alert("change fired");
}
};
}
推荐答案
:
It seems that what you want is ValueChangeHandler
:
textBox.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
// TODO Auto-generated method stub
}
});
这篇关于gwt文本框添加更改处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!