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 updating
Page Index Toggle Pages: 1
controlP5 updating (Read 517 times)
controlP5 updating
Nov 28th, 2007, 8:25pm
 
I wrote sojame himself but didn't get a reply so here goes:

I need to somehow update the sliders that I'm using (about 6 of them) when
their variables change, I'm trying to implement shortcuts for "bigger/smaller brush", etc.

Is there a functions that tells the sliders to re-initialize themselves
with the current values ? I could just use it at the end of my
keyPressed() function and that would be all. I didn't find anything in the documentation about something like that.

If not, any idea on how I could do that ?
Re: controlP5 updating
Reply #1 - Nov 29th, 2007, 3:28am
 
hm, i sent you a mail on the 24th my outbox says. anyway, here is the content.

you can try the setValue function for a controller
Code:

void keyPressed() {
controlP5.controller("yourSlider").setValue(150);
}

taken from the ControlP5SliderSetValue example

in your case i guess this would be something like
Code:

void keyPressed() {
float theValue = controlP5.controller("yourSlider").value();
controlP5.controller("yourSlider").setValue(theValue);
}



currently there isnt  a more elegant way such as e.g. refresh() yet, but may think about it. hope the above works for you.
best,
andi
Re: controlP5 updating
Reply #2 - Nov 29th, 2007, 8:26am
 
wow, thanks. If that works, it's just what I need.

love,
cosmin
Page Index Toggle Pages: 1