RadioButton Implementation
in
Contributed Library Questions
•
2 years ago
I have created a new RadioButton as follows:
RadioButton r;
r = controlP5.addRadioButton("radioButton", 20, 250);
And I add items like this:
r.setItemsPerRow(4);
r.setSpacingColumn(35);
r.addItem("Black", 0.0);
r.addItem("Red", 1.0);
r.addItem("Blue", 2.0);
r.addItem("Green", 3.0);
Let's say I have a method named void radioButton(float rID) {...}
If an event is detected in my radio button, shouldn't this method be automatically called passing in the value of each item?
I would rather handle radio button events like this because I want to have multiple instances of radio buttons in my program, and I don't believe that is possible if I were to use controlEvent.
***EDIT: So after looking at the documentation, I realized events from a radioButton can't be forwarded to a method other than controlEvent in a sketch.
1