Open ScottMit opened 8 years ago
Sounds like a special case which could be customised by extending the ScrollableList class. as a quick workaround I would clear and remove all items from the list which gives you the effect you are looking for? Here a a modified example from the examples that come with controlP5:
import controlP5.*;
import java.util.*;
ControlP5 cp5;
void setup() {
size(400, 400);
cp5 = new ControlP5(this);
List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
/* add a ScrollableList, by default it behaves like a DropdownList */
cp5.addScrollableList("dropdown")
.setPosition(100, 100)
.setSize(200, 100)
.setBarHeight(20)
.setItemHeight(20)
.addItems(l)
;
}
void draw() {
background(240);
}
void dropdown(int n) {
/* request the selected item based on index n */
println(n, cp5.get(ScrollableList.class, "dropdown").getItem(n));
/* remove all items from the list after the first event *
* a quick workaround to disable the dropdown function */
cp5.get(ScrollableList.class, "dropdown").clear();
}
Hi Sojamo,
thanks for the quick response and thanks for the great library. I'm using it to make a phone app to control animal showers at the Melbourne Zoo - this library is making my life super easy and the Giant Tortoises happy!
Reading back over my question I see that it was unclear. I am using a button (somewhere else on screen) to show and hide the ScrollableList. This works well however I want to disable the collapse, i.e. I never want the list to be just the top bar. Is there a way to stop the list from collapsing if the user taps the top bar?
thanks, Scott
I'm having the same issue as Scott. Any update on this?
unfortunately this is currently not possible. Will look into it.
Hi, I am using the ScrollableList to make a COM port selection. Everything is working well however I would like to disable the dropdown function. i.e. if the user clicks the top bar I don't want the list to collapse.
I have tried setType(LIST) however this doesn't seem to change anything.? and I can't do this with a controlEvent() because the dropdown activity doesn't seem to trigger an event.
Am I missing something or should I be using a different controller?
thanks, Scott