controlp5 icon indicating copy to clipboard operation
controlp5 copied to clipboard

keep Scrollable list open

Open Diex opened this issue 6 years ago • 1 comments

Is there any way to keep the Scrollable list open after selecting/clicking on a item?

Diex avatar May 05 '19 16:05 Diex

The source code for ScrollableList shows that it uses the setOpen() function to close the list after an item is selected (triggered by onRelease()). To counter that, I used a CallbackListener to detect when an item is selected and forced the list to stay open.

ControlP5 cp5 = new ControlP5(this);
ScrollableList list = cp5.addScrollableList("list").addItems(new String[] {"a", "b", "c"});
list.onRelease(new CallbackListener() {
  public void controlEvent(CallbackEvent theEvent) {
    list.setOpen(true);
  }
});

kayserifserif avatar Aug 09 '19 16:08 kayserifserif