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 slider color and boolean pressed
Page Index Toggle Pages: 1
ControlP5 slider color and boolean pressed (Read 608 times)
ControlP5 slider color and boolean pressed
May 14th, 2009, 5:12am
 
Hi all,
I’m starting to use sliders with ControlP5, and I need a little help with some basic things:
1) I don’t find the way to have a boolean that tells me when de slider is pressed or changed.
2) I need to change the color of the slider background.

Thanks a lot for the help
David
Re: ControlP5 slider color and boolean pressed
Reply #1 - May 16th, 2009, 9:11pm
 
hi there.
1) the variables that would tell you the states you are looking for are not visible, they are protected inside controlP5, i will make them public for future releases. meanwhile this example might help? whenever you move the slider, function mySlider will be called and tells you when the slider has been pressed or changed.
Code:

import controlP5.*;

ControlP5 controlP5;
Slider s;
void setup() {
size(400,400);
controlP5 = new ControlP5(this);
s = controlP5.addSlider("mySlider",100,167,128,100,160,10,100);
s.setColorBackground(color(255,0,0));
}

void draw() {
background(0);
}

public void mySlider(float theValue) {
// when a slider is pressed, it will execute an
// event and notify its listeners, in this case function
// mySlider - mySlider isa function with the same
// name as the slider itself.
println("slider mySlider has fired an event. value is : "+theValue);
}
 

2)
see above example.
Code:

s.setColorBackground(color(255,0,0));


best,
andreas



Page Index Toggle Pages: 1