How make cursor doesn't go in new line when i press Enter in TextArea (in GWT)?
I tried method te开发者_Python百科xtArea.setCursorPos(0) but it didn't work. May be it is posiible to resolve by Java Script but i don't know((
In JavaScript you can use return false;
or event.returnValue = false;
(IE), event.preventDefault(); (FF, Chromium, Opera) in event handler.
With GWT you just use the NativeEvent's preventDefault() method
area.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getCharCode() == 13) {
event.preventDefault();
}
}
});
精彩评论