sojamo / controlp5

A gui library for processing.org
GNU Lesser General Public License v2.1
490 stars 142 forks source link

update multiple Sliders #91

Closed p1234321 closed 7 years ago

p1234321 commented 7 years ago

Hello, First of all thanks for the great library! I'm trying to make a small artnet interface with multiple sliders which are expandable. i create the sliders by: `

for (int i=0;i<channelArray.length;i++) { s = cp5.addSlider("ch"+i,0,255); s.setValue(int(channelArray[i])); s.setId(i); s.setSize(20,100); s.setPosition(startPosX+i*offSet,startPosY); s.setDecimalPrecision(0); } ` for the beginning i created 16 channels >> 16 sliders, which works well. but now i want to load different settings from xml files and update the sliders accordingly. how can i adress the individual sliders via a for loop?

best regards

paul

sojamo commented 7 years ago

hi, you can access a controller with cp5.get() and the set the value with setValue()

String controllerName = "ch4";
float value = random(100);
cp5.get(controllerName).setValue(value);
p1234321 commented 7 years ago

thank you very much! everything works now!

best regards

paul


paul pritz hugo-wolf-gasse 10/81 8010 Graz tel: 06503332443

Am 01.12.2016 um 04:21 schrieb andreas schlegel notifications@github.com:

hi, you can access a controller with cp5.get() and the set the value with setValue()

String controllerName = "ch4"; float value = random(100); cp5.get(controllerName).setValue(value); — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sojamo/controlp5/issues/91#issuecomment-264068438, or mute the thread https://github.com/notifications/unsubscribe-auth/ALgoi3KtQoZHLEQwyO9RP0x1m0aQ6zoVks5rDj0-gaJpZM4LAOFj.