ControlP5 and Group
in
Contributed Library Questions
•
1 year ago
I'm looking at this example for dev's site
/** * ControlP5 Group * * * find a list of public methods available for the Group Controller * at the bottom of this sketch. * * by Andreas Schlegel, 2012 * www.sojamo.de/libraries/controlp5 * */ import controlP5.*; ControlP5 cp5; void setup() { size(700,400); cp5 = new ControlP5(this); Group g1 = cp5.addGroup("g1") .setPosition(100,100) .setBackgroundHeight(100) .setBackgroundColor(color(255,50)) ; cp5.addBang("A-1") .setPosition(10,20) .setSize(80,20) .setGroup(g1) ; cp5.addBang("A-2") .setPosition(10,60) .setSize(80,20) .setGroup(g1) ; Group g2 = cp5.addGroup("g2") .setPosition(300,100) .setWidth(300) .activateEvent(true) .setBackgroundColor(color(255,80)) .setBackgroundHeight(100) .setLabel("Hello World.") ; cp5.addSlider("S-1") .setPosition(80,10) .setSize(180,9) .setGroup(g2) ; cp5.addSlider("S-2") .setPosition(80,20) .setSize(180,9) .setGroup(g2) ; cp5.addRadioButton("radio") .setPosition(10,10) .setSize(20,9) .addItem("black",0) .addItem("red",1) .addItem("green",2) .addItem("blue",3) .addItem("grey",4) .setGroup(g2) ; } void draw() { background(0); } void controlEvent(ControlEvent theEvent) { if(theEvent.isGroup()) { println("got an event from group " +theEvent.group().name() +", isOpen? "+theEvent.group().isOpen() ); } else if (theEvent.isController()){ println("got something from a controller " +theEvent.controller().name() ); } } void keyPressed() { if(key==' ') { cp5.group("g1").remove(); } }
theEvent is a ControlEvent object. But in JavaDoc documentation http://www.sojamo.de/libraries/controlP5/reference/index.html i cannot see any group() function..where is it? What about the error i see when running this example?
Thanks :D
1