error controlle event slider
in
Contributed Library Questions
•
9 months ago
Good afternoon.
I have problems with my slider and playback of events.
can help me?
thank you for reading.
I have problems with my slider and playback of events.
- import controlP5.*;
ControlP5 cp5;
RadioButton RadBut_courbe;
Slider Slider_analog;
int myColorBackground = color(0,0,0);
void setup() {
size(200,300);
cp5 = new ControlP5(this);
// RadBut_courbe= cp5.addRadioButton("radioButtonName",50,50);
// r.setSize(100,100);
// r.addItem("itemName",0);
radioButton();
control_analogique();
}
void draw() {
background(myColorBackground);
}
void radioButton() {
RadBut_courbe = cp5.addRadioButton("COURBA",178,38);// 30, 26
// RadBut_courbe.setId(12);
RadBut_courbe. setItemHeight(20);
RadBut_courbe. setItemWidth(20);
RadBut_courbe.setItemsPerRow (1);
RadBut_courbe.setSpacingColumn(10);
RadBut_courbe. setSpacingRow(15);
RadBut_courbe.addItem("A0",0);
RadBut_courbe.addItem("A1",1);
RadBut_courbe.addItem("A2",2);
RadBut_courbe.addItem("A3",3);
RadBut_courbe.addItem("A4",4);
RadBut_courbe.addItem("A5",5);
// RadBut_courbe.setImages(loadImage("imageDefault20_1.png"),loadImage("imageDefault20_1.png"), loadImage("imageActive20_1.png"));
}
void controlEvent(ControlEvent theEvent) {
// print(" "+theEvent.group());
print("got an event from "+theEvent.group().name()+"\t");
for(int i=0;i<theEvent.group().arrayValue().length;i++) {
print(int(theEvent.group().arrayValue()[i])); // valeur binaire
}
println("\t "+theEvent.group().value()); // id du radioboutton
myColorBackground = color(int(theEvent.group().value()*50),0,0);
}
void control_analogique(){
// addSlider(theName, theMin, theMax, theDefaultValue, theX, theY, theW, theH)
Slider_analog=cp5.addSlider("Analogique",1,1024,0,30,40+(35),110,15); // ajoute un Slider au ControlP5
//Slider_analog.setWindow(controlWindow); // met l'objet dans la fenêtre
//Slider_analog = (Slider)cp5.controller("MonSlider1"); // initialise l'objet Slider déclaré
// méthodes propres à l'objet Slider
//Slider_analog[i].setNumberOfTickMarks(10); // fixe le nombre crans - n+1 pour n valeurs
//sliderCoeff.setNumberOfTickMarks((int(s1.max())+1); // fixe le nombre crans - n+1 pour n valeurs
//Slider_analog[i].showTickMarks(true); // affichage des repères
//Slider_analog.setSliderMode(Slider.FLEXIBLE); // fonctionnement du slider FLEXIBLE ou FIX
// méthodes communes à tous les controles (objet Controller)
Slider_analog.setLabelVisible(true); // affichage des labels
/* //Slider_analog[i].setLabel("Coefficient"); // fixe label objet
Slider_analog.setDecimalPrecision(0); // fixe la précision
Slider_analog.setColorActive(color(192,192,192)); // fixe la couleur active
Slider_analog.setColorBackground(color(192,192,192)); // fixe couleur fond
Slider_analog.setColorForeground(color(192,192,192)); // fixe couleur avant
Slider_analog.setArrayValue(new float[] {00,1023} ); // fixe les valeurs min/max du Slider ?
Slider_analog.setColorCaptionLabel(color(0)); // fixe couleur Label
Slider_analog.setColorValueLabel(color(192,192,192)); // fixe la couleur valeur
*/
} //fin de la boucle
- Display 0 does not exist, using the default display instead.
ControlP5 0.5.4 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
got an event from COURBA 100000 0.0
11 janv. 2013 07:38:24 controlP5.ControlBroadcaster printMethodError
GRAVE: An error occured while forwarding a Controller value
to a method in your program. Please check your code for any
possible errors that might occur in this method .
e.g. check for casting errors, possible nullpointers, array overflows ... .
method: controlEvent
exception: java.lang.reflect.InvocationTargetException
can help me?
thank you for reading.
1