Slider setValue, how to?

Completly noob so I suppose this issue should be fairly easy to solve. Sorry about that.

I'm simply trying to control a slider with a joystick. Essentially I poll joystick events via SDL lib in a separate class which is initialised in MyApp class.

 Actually I can interact with my slider via others JUCE components (e.g. a button), but no way to do that via my joystick class.

Essentially the question is : how to properly implement a broadcaster/listener system ? I messed around classes, but i can't figure out how to do that.

Hope this is clear and thx in advance for any suggestion.


1. In the class you receive your joystick events, add a Value member called e.g. sliderValue.

2. Refer to the same underlying val as the slider (you need to do this only once, e.g. in the constructor of your class):

sliderValue.referTo (<reference or pointer to your slider>.getValueObject());

3. In your poll function, add

sliderValue = var (<joystick value>);

Thats it. The slider is already a listener to its internal value, so it will react to this assignment.

Ok Samuel, Done. Thank you very much !