How to intercept KeyPressEvent in Java GWT? -
i new java , in our code using gwt.
we using keypressevent
process key_enter
request. seems, each enter request, 2 events fired keypressevent
. expect 1 event should fired, since enter 1 time.
the following code. please check , let me know, need correct ..
void onenter(keypressevent event) { if(event.getnativeevent().getkeycode() == keycodes.key_enter) { //(seems times code called) //domy stuff } }
if use event.getcharcode()
instead of event.getnativeevent().getkeycode()
, returns 0.
any idea how fix.
thanks,
i prefer using keyupevent
because user can't distinguish keypressevent
here solution:
void onkeyup(keyupevent event) { if(event.getnativekeycode() == keycodes.key_enter) { // handle key press } }
Comments
Post a Comment