Vertical Two value slider range


Is it possible to have a Two value (min/max) vertical slider, (with a range of min 0-> max 1) but with the min at the bottom, and the max at the top?(My single value slider works this way)

I tried a -ve skew value (It didn’t like that! :twisted: )
I tried reversing the SetRange(1.0, 0)
and SetRange with a -ve step size

(BTW, I’m using the latest version of the juce_slider class from SVN)


Check out the proportionOfLengthToValue functions - overriding them lets you remap the numbers it produces. (Actually, not sure if these will work with backwards ranges, but it might be ok)


Thanks, as ever, Jules!

This seems to do the job -

file: MySlider.h

#ifndef MYSLIDER_H
#define MYSLIDER_H
#include "Juce.h"


class MySlider : public juce::Slider
	MySlider (const String& componentName): Slider(componentName) {};

	~MySlider() {};


	double proportionOfLengthToValue (double proportion) { return Slider::proportionOfLengthToValue(1.0f-proportion);};

	double valueToProportionOfLength (double value) { return 1.0f-(Slider::valueToProportionOfLength(value)); };

#endif //MYSLIDER_H

{Whether you like it or not, you and many others here are doing a fabulous job at improving my C++}