ControlP5 RadioButton default

edited February 2014 in Library Questions

Hello,

trying to create a set of radio buttons. Works fine, except I can't find a way to select one of the radios to be on, or 1, or true, or all of these, by default. Here is the reduction of what I use so far:

import controlP5.*;

ControlP5 cp5;

void setup() {
  size(600, 600);
  background(0);
  cp5 = new ControlP5(this);
  cp5.addRadioButton("scaleRadio")
    .setPosition(195, 285)
      .setSize(30, 30)
         .setItemsPerRow(4)
            .setSpacingColumn(30)
               .addItem("1000", 1000)
                  .addItem("500", 500)
                      .addItem("200", 200)
                         .addItem("100", 100)
                          ;
}

void draw() {
  background(0);

}

Any help appreciated!

Tagged:

Answers

  • edited February 2014 Answer ✓

    Just look at the example(s) that come with the library. It's both in the code example itself and in the list of the controller methods that is printed beneath each example.

    You can use: .activate(2) // where 2 is the number of the button you want to select

  • edited February 2014

    Thanks! Yeah I'm not reading very well... I'm coming to Java the wrong way. Like, I don't even know the name to the .doesSomething() bits. Hopefully the class I'll be going to in June will help me get a better grip on the handling of classes and methods.

Sign In or Register to comment.