Hello. Basically I'm getting outputs from key pressed buttons and I also want to have textfields. How do I make sure that when I'm writing on a textfield I don't get the outputs from the main code. I started with the code like this and I think the problem is I don't know how the function isFocus() works. Onoff is never getting true
import controlP5.*;
boolean onoff = false;
ControlP5 cp5;
void keyPressed() {
}
if ((key == 'a') && (onoff == false)) {
//Do something normally
}
}
cp5 = new ControlP5(this);
cp5.addTextfield("input_1")
.setPosition(20, 40)
.setSize(200, 40)
Textfield tf = (Textfield) cp5.getController("input_1");
if (tf.isFocus() == true) {
onoff=true;
}
else {
onoff=false;
}