More ControlP5 Questions
in
Contributed Library Questions
•
1 years ago
Looks like my replies to the other question got lost in the "soup."
With the checkbox, I used the example code, worked great. Then I broke it. The checkbox is meant to signal to another part of the program a boolean variable, to detirmine the functions of the rest of the code (do we take path A or path B?). I would like that boolean variable passed along when I click the button.
This works:
void controlEvent(ControlEvent theEvent) {
boolean haspreface = boolean((int)theEvent.group().arrayValue()[0]);
println(haspreface);
}
But as far as I can tell, it can't really return a value with a "void." This, however, doesn't work:
void Generate(ControlEvent theEvent) {
println("Generating");
boolean haspreface = boolean((int)theEvent.group().arrayValue()[0]);
println("Haspreface is: " + haspreface);
}
Should I have the event for the checkbox inside my buttons code, or should it be seperate in code?
The error given is:
01/11/2011 2:48:46 PM controlP5.ControlBroadcaster printMethodError
SEVERE: 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
Additionally, I need to have two .JPGs in the program, a banner at the top of the window (a 640 x 480 window), probably of 640 x 80, and an instructions banner down the side, of 100 x 400. I've come across some code I'm itching to try out, but it loads the thing up as a button - uh, not exactly what I'd like. I just need it as an element.
Thanks!
With the checkbox, I used the example code, worked great. Then I broke it. The checkbox is meant to signal to another part of the program a boolean variable, to detirmine the functions of the rest of the code (do we take path A or path B?). I would like that boolean variable passed along when I click the button.
This works:
void controlEvent(ControlEvent theEvent) {
boolean haspreface = boolean((int)theEvent.group().arrayValue()[0]);
println(haspreface);
}
But as far as I can tell, it can't really return a value with a "void." This, however, doesn't work:
void Generate(ControlEvent theEvent) {
println("Generating");
boolean haspreface = boolean((int)theEvent.group().arrayValue()[0]);
println("Haspreface is: " + haspreface);
}
Should I have the event for the checkbox inside my buttons code, or should it be seperate in code?
The error given is:
01/11/2011 2:48:46 PM controlP5.ControlBroadcaster printMethodError
SEVERE: 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
Additionally, I need to have two .JPGs in the program, a banner at the top of the window (a 640 x 480 window), probably of 640 x 80, and an instructions banner down the side, of 100 x 400. I've come across some code I'm itching to try out, but it loads the thing up as a button - uh, not exactly what I'd like. I just need it as an element.
Thanks!
1