Hi, I’m trying to access label names using mouseover in a scrollable list, I have found the following but can’t get it to work - can anyone show me a working example of this?
Thanks
public class MyScrollableList extends ScrollableList {
// the constructor is required, since there is no constructor in
// ScrollableList that allows for implicit calling
MyScrollableList (ControlP5 controlp5, String name) {
super(controlp5, name);
}
// returns -1 if nothing is selected
int getHover() {
return itemHover;
}
}
// ...
MyScrollableList myScrollableList = null
myScrollableList = new MyScrollableList (cp5, "myScrollableList");
myScrollableList.setPosition(10, 10)
.setSize(280, 300)
.setItemHeight(15);
// ...
int hoveredItem = myScrollableList .getHover();
if (hoveredItem >= 0) {
Map<String , Object> item = myScrollableList getItem(hoveredItem);
println(item.get("name").toString());
}