hi florian,
so i made some changes, version 0.2.7, ready for download.
(1) update of textfield.setValue(String) works now.
(2) removing, adding items show/hide scrollbar works now. (check with example below)
(3) parent() is public now, see example below.
(4) there is a conceptual error in how the scrollList is designed so a lot of scrollList items take a long time to load since for each item a button is created, but actually only as many buttons as are visible should be created. this might take a few more days to be fixed.
Quote: - controlEvents seem to get fired while others still are running. one student manipulates a scroll list inside controlEvent which seems to fire a second controlEvent for the vertical scroll bar being updated .. not sure this is wanted.
hm, that shouldnt happen, can you provide the code for the controlEvent (pm if too long)?
Code:
import controlP5.*;
ControlP5 controlP5;
ScrollList l;
int cnt;
void setup() {
size(400,400);
frameRate(30);
controlP5 = new ControlP5(this);
l = controlP5.addScrollList("myList",100,100,120,280);
l.setLabel("myLabel");
for(int i=0;i<40;i++) {
controlP5.Button b = l.addItem("a"+i,i);
b.setId(100 + i);
}
}
void controlEvent(ControlEvent theEvent) {
println(theEvent.controller().parent()+" / "+l);
// check if the parent of the controller equals our scrollList
if(theEvent.controller().parent().equals(l)) {
println("an event from our list");
}
}
void keyPressed() {
if(key==',') {
l.addItem("av"+((int)random(10000)),0);
} else if(key=='.') {
cnt++;
l.removeItem("a"+cnt);
}
}
void draw() {
background(0);
}