On any French keyboard (AZERTY), the point is char '. created using a combination of + , and percent char '%' is generated using a combination of + Shift; Shiftù
Therefore, when I enter one of the above combinations into the GWT text area for writing '.' or "%", the key codes generated for these events are KEY_DELETEin the first case and KEY_LEFTthe last.
TextArea txtArea = new TextArea();
txtArea.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
switch (charCode) {
case KeyCodes.KEY_LEFT: {
System.out.write("KEY LEFT");
break;
}
case KeyCodes.KEY_DELETE: {
System.out.write("DELETE");
break;
}
}
Workaround : get charCode and perform character mapping:
charCode = event.getCharCode();
if (charCode == '.') {...}
else if (charCode == '%') {...}
Is this a GWT bug? And is there a more elegant way to handle this?