Hi, I have a simple question about ScrollableLists in controlP5.
I want to acces the "name" or "text" behind the items in a ScrollableLists.
How do I access them, and for instance set a string (in code below named "selected") equal to the value of the item on the list that is selected?
import controlP5.*;
import java.util.*;
ControlP5 cp5;
String selected = "";
void setup() {
size(400, 400);
cp5 = new ControlP5(this);
List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
cp5.addScrollableList("dropdown")
.setPosition(100, 100)
.setSize(200, 100)
.setBarHeight(20)
.setItemHeight(20)
.addItems(l)
;
}
void draw() {
background(120);
text("You have selected: " + selected, 100, 300);
}