Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Change the number of tick marks on ControlP5 Slider

$
0
0

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
    }
  }
}

Viewing all articles
Browse latest Browse all 2896

Trending Articles