ControlP5: ScrollableList getValue()

edited April 2016 in Library Questions

Hi,

I want to read from my draw() what's the value of the selected item in a ScrollableList object. I don't want to read after changing the item selection. I want to read the selected item from the draw().

That works, but I guess there is a easier way. It's fine with 1 scrollableList, but it doesn't look very nice with 20 scrollableList.

void draw() {

 selectedItem = (int)cp5.get(ScrollableList.class, "myScroll").getValue();
  int filterNameID = (int)cp5.get(ScrollableList.class, "myScroll").getItem(selectedItem).get("value");

}

Any suggestion?

Thanks.

Tagged:

Answers

  • I mean, with

    (int)cp5.get(ScrollableList.class, "myScroll").getValue()

    I get the item ID, not the item value. So, I have to do it in two steps.

    With DropDownList and past version of ControlP5, with getValue() I get.. the value. It looks weird to me. The getValue() doesn't give you the value, it gives you the ID.

    Best.

Sign In or Register to comment.