How to set a range to an integer inputfilter

I struggle with the problem of limiting the text input to the numbers 4,5,6,7 and 8 only. The .setRange(4,8) in the example obvious does not work. Thanks in advance for your help.

void setup() { size(200, 200); cp5 = new ControlP5(this); cp5.addTextfield("any int value 4 to 8") .setPosition(20, 20) .setSize(80, 30) .setAutoClear(false) .setInputFilter(ControlP5.INTEGER) .setText("4") //.setRange(4,8) the textfield may only accept the values 4,5,6,7, and 8 ;

cp5.addBang("Submit") .setPosition(20, 70) .setSize(80, 30) ; }

void draw () { background(0); }

void Submit() { url1 = cp5.get(Textfield.class, "any int value 4 to 8").getText(); }

Sign In or Register to comment.