Welcome to my blog, hope you enjoy reading
RSS

Thursday 23 January 2014

GWT KeyPressHandler getCharCode issues

GWT KeyPressHandler getCharCode issues 

  • event.getNativeEvent().getKeyCode()
  • KeyCodes.KEY_ENTER=13
This code returns the '10' in chrome so the following code is not working.
  • if(event.getNativeEvent().getKeyCode()==KeyCodes.KEY_ENTER)
This code returns the '13' in firefox so the following code is working. 

so like the code like following for both chrome and firefox
  • if(event.getNativeEvent().getKeyCode()==13)
  • {
  • //Do something
  • }else if(event.getNativeEvent().getKeyCode()==10)
  • {
  • //Do something
  • }



0 comments: