Slider::TwoValueHorizontal assertion with JUCE 5.3.2


Example code which will trigger that assertion:

slParam1.setRange(0.3, 4.0);

Now, when moving the slider knobs, the NormalisableRange assertion in static ValueType clampTo0To1 (ValueType value) will be triggered.

Reason: When setting the Range, the value won’t be clipped to the new limits. So it will be outside the range!

In the Slider’s pimpl, updateRange() method this should be added:
setValue (getValue(), dontSendNotification);

However, this will then trigger another assertion as getValue() is only allowed for anything but TwoValuedSliders… So maybe adding a force flag to getValue() ? Or just using currentValue.getValue();instead of getValue() but that’s also not a nice solution…

Oh and of course the setValue() then also will trigger an assertion…

Another edit:
Or just not updating lastAngle in the Slider’s mouseDown method if the Slider is of style TwoValued… maybe the best of my solutions :wink:


gentle bump

btw, it could be handy to have those 2 methods in Slider :

bool isTwoValue() const noexcept
    return style == TwoValueHorizontal || style == TwoValueVertical;

bool isThreeValue() const noexcept
    return style == ThreeValueHorizontal || style == ThreeValueVertical;


I also added an issue for that a while ago:


This should be fixed on develop shortly.