We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I want the textfield to block once it receives a value.
I've seen there is a Textfield lock() method but I don't know how to use it.
import controlP5.*;
ControlP5 cp5;
color ccolor=color(250, random(100), random(100));
void setup() {
size(700,400);
PFont font = createFont("arial",20);
cp5 = new ControlP5(this);
cp5.addTextfield("Subject number")
.setPosition(20,170)
.setSize(200,40)
.setFont(createFont("arial",20))
.setAutoClear(true)
.setColorLabel(ccolor);
;
cp5.addBang("OK")
.setPosition(240,170)
.setSize(40,40)
.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER)
;
textFont(font);
}
void draw() {
background(0);
fill(255);
}
void controlEvent(ControlEvent theEvent) {
if(theEvent.isAssignableFrom(Textfield.class)) {
println("controlEvent: accessing a string from controller '"
+theEvent.getName()+"': "
+theEvent.getStringValue()
);
}
}
Answers
bump