MyTitle MyTitle - 1 year ago 90
Java Question

Determine "Backspace" button pressing

How to determine in GWT that user pressed Backspace button? I tried this, but it does not work

public void onKeyPress(KeyPressEvent event) {
char charCode= event.getCharCode();
if(charCode == (char) KeyCodes.KEY_BACKSPACE){
//do someThing

Answer Source

The keypress event is implemented in most browsers as only firing when a character would be produced (and that's how it's being standardized: ). Backspace obviously doesn't produce a character; you should use keydown or keyup to detect it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download