This is in continuation of my other question. I am checking if a valid character or number is being pressed
Valid Characters - A to Z and a-z, these characters can be entered using "SHIFT+A=a" and vice-versa "SHIFT+a=A". I am restricting the user to enter other than valid characters
Invalid Characters - "SHIFT+1=!" to "SHIFT+0=)"
Heres a code snippet, which I tried but not sure how to get keyCode of "SHIFT+...."
@Override
public void onBrowserEvent(Context context, Element parent, String value,
NativeEvent event, ValueUpdater<String> vUpdater){
if (event.getShiftKey()) {
int code = event.getKeyCode();
//only a-z and A-Z are allowed if shift key is pressed
if ((code >= 65 && code <= 90) || (code >= 97 && code <= 122)) {
validShiftKeyPressed = true;
} else {
validShiftKeyPressed = false;
}
}
if (validShiftKeyPressed &&
(event.getKeyCode()>=48 && event.getKeyCode()<=57)){
\\do some operation
}
int code = event.getKeyCode();
The value of the code will always be 16 and validShiftKeyPressed will always be false.
I want to check the value of SHIFT+A or SHIFT+1 or any other combination is pressed. Is there any way this is possible?