We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › controlP5 toggle arrays
Page Index Toggle Pages: 1
controlP5 toggle arrays (Read 279 times)
controlP5 toggle arrays
Jan 9th, 2009, 3:23pm
 
Hello,

does anybody know a possibilitie to toggle arrays with controlP5? I was trying something like:


import controlP5.*;
ControlP5 controlP5;

boolean[] toggleValue = new boolean[2];
boolean ref_toggle = false;

void setup() {
 size(400,400);
 smooth();
 
 for (int i = 0; i < 2; i++){
   toggleValue[i] = false;
 }
 controlP5 = new ControlP5(this);
 controlP5.addToggle("toggleValue[0]",false,100,160,20,20);
 controlP5.addToggle("toggleValue[1]",true,100,240,20,20).setId(1);
 controlP5.addToggle("ref_toggle",true,100,280,20,20).setId(1);
}
 
void draw() {
 println(toggleValue[0]);
 println(toggleValue[1]);
 println(ref_toggle);
}



So there's not much being wrong but it wouldn't work. Is that just something that the controlP5 can't do, or is there some way to get arround it? I've got a huge array to manage, so i really need a sollution...

cheers!
Re: controlP5 toggle arrays
Reply #1 - Jan 29th, 2009, 7:03pm
 
name controllers with "name"+i, instead of "name[i]".  see my post here:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=LibraryProblems;action=display;num=1228715265;start=4#4

but it only solves half of the problem.  
Page Index Toggle Pages: 1