UPDATE-
Needed to read some Java docs on how to use Map– here is my solution:
cwDropdown.getItem((int)val).get("text")
Though it returns as an Object rather than a String…
Hi-
I’m having a heck of a time getting the string of the selected item in a DropdownList or ScrollableList within controlP5.
On my selection event, I can’t seem to figure out what will pull the selected item’s TEXT or LABEL as a string.
/// Change colorway
val = theEvent.getController().getValue();
if (theEvent.getController().getName()== guiColorwayString) {
// Displays something incorrect- possibly the initial value of the DropdownList?
println(".getText() : " + theEvent.getController().getValueLabel().getText());
// Displays "...valuelabel (255,255,255), name=WHITE on WHITE, text=WHITE on WHITE..." in Console but can't figure out how to "get" `name` or `text` as a string?
println("cwDropdown: " + cwDropdown.getItem((int)val));
}
Any help would be greatly appreciated!