Hi all. First post here so please be gentle :-)
Been trying to get a drop down menu to work, based on the example below, the menu displays and responds fine but i can't figure out how to read what 've actually selected. The "controlEvent" doesn't appear to respond as I click on menu items. Tried processing 2 and 3 and updated my controlP5 library.
Can anyone offer any help? Thanks.
import controlP5.*;
ControlP5 cp5; // you always need the main class
int b = 0 ;
void setup() {
size(300, 300);
cp5 = new ControlP5(this);
// add a dropdownlist at position (100,100)
DropdownList droplist = cp5.addDropdownList("mySuperList").setPosition(100, 100);
// add items to the dropdownlist
for (int i=0; i<5; i++) {
droplist.addItem("myItem " + i, i);
}
}
void draw() {
background(0);
// controlp5 autodraw is on by default (if you use the default JAVA2D renderer)
// this means the gui is automatically drawn at the end
}
// controlEvent monitors clicks on the gui
void controlEvent(ControlEvent theEvent) {
if (theEvent.isGroup()) {
println(theEvent.getGroup() + " => " + theEvent.getGroup().getValue()); // *** this isn't responding ***
}
}