How to set Slider double click behaviour without changing the default value?

there is nice method Slider::setDoubleClickReturnValue(), but actually it has two functions:

  1. setting the behaviour of slider double clicking
  2. setting new default value of slider.

But I want to have my own type of slider inherited by juce::Slider, and I want make it to always react on double click in the same manner. So I would like to call in my constructor the Slider::setDoubleClickReturnValue(). But it also ask me for default value which I don’t know yet in the constructor.

Is it intentional?

For any help great thanks in advance.

generally in C++ the answer to “how to add behaviour to existing behaviour” is:

struct SomeClass :
    public SomeBaseClass
    void someFunc(Type someArg) override

again a great opportunity to drop my video in which I apply this technique to add sensitive mousewheel to juce::Slider

Thanks Mrugalla,
yes you are right. But I’ve just solve my issue in other manner, because setDoubleClickReturnValue() is not virtual, so I needed to make new method. And in my case I use many times Slider::setNormalisableRange(NormalisableRange<double>);

So I wrote my own method:
Slider::setNormalisableRange(NormalisableRange<double> newRange, double defaultValue);

And inside that method I call Slider::setDoubleClickReturnValue(true, defaultValue, myModKey)

But it is not good solution becouse now, to make it work I need to call that function in all my projects. And I will always remember in the future to use it instead regular setNormalisableRange()

But if I could do that in constructor, it would work everywhere at once. But in the constructor I don’t know the default value.

So it looks like your solution is not what I am askin for. But of course maybe there is some other point of view :slight_smile: