controlp5 code managment
in
Contributed Library Questions
•
1 year ago
Hello,
how to change this code that if I press radiobutton "A", code in 21-22 lines would be executed, if I press "B" nothing happen, if I press "C", code in 25'th line would be activated. I know it's noob question, but I am really new in programming.
thank you for help.
- import controlP5.*;
- ControlP5 p5;
- RadioButton p;
- void setup() {
- size(400, 300);
- p5 = new ControlP5(this);
- p = p5.addRadioButton("option")
- .setPosition(80, 100)
- .addItem("A", 1)
- .addItem("B", 2)
- .addItem("C", 3)
- .activate("A")
- ;
- Toggle t = p.getItem("A");
- // if pressed "A" execute this line if presed "B", do not execute this line
- for (int i =0; i<5; i++) {
- println(i);
- }
- // if pressed "C" execute this line
- println("thanks for help");
- }
- void draw() {
- background(0);
- }
1