We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm wanting to change the number of tick marks on a Slider in the CP5 library after the Slider has been created.
Anyone have an idea on how to do this? Example below would change the number when the space key is pressed.
import controlP5.*;
ControlP5 cp5;
void setup() {
size(300, 125);
noStroke();
cp5 = new ControlP5(this);
cp5.addSlider("slider")
.setPosition(50, 40)
.setSize(200, 20)
.setRange(0, 200)
.setNumberOfTickMarks(10)
;
}
void draw() {
background(0);
}
void keyPressed() {
if (key==' ') {
if (cp5.getController("slider") !=null) {
// change the number of ticks here
}
}
}
Answers
I hope this helps,
Kf
That does it. Thank you!