Reverse Slider Direction



I am trying to create a slider that will increase in value as the slider handle is dragged down (or left).  There doesn't appear to be any property I can set to do this, so I'm wondering if I need to go ahead and extend the Slider class to do this behavior or if there is an easier way?




class Slider_reverse : public JUCE_NAMESPACE::Slider
    Slider_reverse (const String& componentName): JUCE_NAMESPACE::Slider(componentName) {};
    ~Slider_reverse() {};
    double proportionOfLengthToValue (double proportion) {   return JUCE_NAMESPACE::Slider::proportionOfLengthToValue(1.0f-proportion);};
    double valueToProportionOfLength (double value) {   return 1.0f-(JUCE_NAMESPACE::Slider::valueToProportionOfLength(value)); };    


what about rotating the Slider by Pi using an AffineTransform around its centre?


The derived class worked perfectly.  I didn't noticed those methods when I was looking at the Slider class.




Rotating will make things such as text to look different. One wouldn’t want the text rotated…


You could also implement a custom lookandfeel for the Slider in which you change the way it paints. Benefit is that you don’t need to use a derived class.


Do you know where and how to implement this to a slider parameter listener?

Editor vs Processor side?


I ended up just throwing it in a custom slider class, works like a dream!