Processing Error In Reading Keyboard Coded Keys

edited September 2017 in Using Processing

Using Processing 3.2.3 on WIndows 7 Pro, here is the code to test:

void keyPressed() { println("key="+key + " and code="+keyCode); if(key == CODED) println("code="+keyCode); else println("key=" + key); }

Running this code in one sketch I get the following output when I press the F1 key:

key=? and code=112 code=112

Running the same code in the Processing example program ArcLengthParametrization, I get the following output when I press the F1 key:

key=? and code=97 key=?

This makes no sense. Why would one sketch recognize the F1 key and return one keyCode value while the other sketch does not recognize the F1 key and returns a completely different value?

One point of note. The first result is what I see when running in a sketch that uses only one tab. The second result is what I see when running in a sketch that has more than one tab.

So what does the number of code tabs have to do with how Processing reads the keyboard? Ideas? Does anyone else see this same problem?

Tagged:

Answers

Sign In or Register to comment.