We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there,
I am trying to figure out how could I switch (jump) between two different controlls (textfields) using controlp5 library. The expected result should be same as in browser when You want to jump between text fields using 'TAB' button. I've tried to set up an textField as 'active', but cant figure out how to do it properly.
tl.dr:
After I type anything in 'input_1' I want to press TAB or ENTER to start typing in 'input_2' field. Needed help.
import controlP5.*;
ControlP5 cp5;
void setup() {
size(350, 300);
GenerateGUI();
}
void draw() {
background(#353534);
}
void GenerateGUI() {
cp5 = new ControlP5(this);
//"Nazwa Kontrahenta"
cp5.addTextfield("input_1")
.setPosition(20, 40)
.setSize(200, 40)
.setFocus(false)
.setAutoClear(false)
.setColor(color(#353534))
.setColorBackground(color(#FFE236))
;
cp5.addTextfield("input_2")
.setPosition(20, 100)
.setSize(200, 40)
.setAutoClear(true)
.setColor(color(#353534))
.setColorBackground(color(#FFE236))
;
}
I would appreciate any help :)
Answers
ok. I figured it out by myself.
If anyone is interested - bellow You can find a code that 'jumps' between textFields as explained above. Additional problem that occured was setting the clicked textField as active. I've also figured this
out.