Example code which will trigger that assertion:
addAndMakeVisible(slParam1);
slParam1.setSliderStyle(Slider::TwoValueHorizontal);
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!
Solution:
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 ![]()
