Hi!
So I am currently working on a programm with an Excel-table based structure, and I am using Tab, the mouse and the arrow keys for moving. There was this one problem that wasn’t that big of a deal, but always annoyed me: whenever I typed ‘ä’ or ‘Ä’ in, the program would switch to the next field. Turns out ä and the RIGHT-Arrow share the same keyCode: 39. You probably can’t test this on your keyboard, so here’s a screenshot that proves it. Kind of.
1 Like
only have a US keyboard on win7 PC ( english (US) ),
but allow GE keyboard and use ON SCREEN keyboard give me
so, please also try the
int(key)
possibly can distinguish for the arrow keys.
@kll You’re right, I could test for that. However the problem stays, and I solved it by checking if key != 'ä' && key != 'Ä'
.
or use == CODED
https://www.processing.org/reference/keyCode.html
Chrisir
void setup() {
size(220, 220);
}
void draw() {
}
void keyPressed() {
if (key==CODED) {
// CODED
if (keyCode == CONTROL) {
//CTRL
println("is a CTRL");
}//if
} else {
// not CODED
if (key=='ä') {
println("is an ä");
}//if
}//else if
}
//
2 Likes
Yes, checking CODED first before checking for RIGHT is the correct way to do this, according to the reference and examples:
1 Like
Thanks! That is a far better solution that the one I found.
1 Like