Double click to edit slider label


#1

On labels, you can use setEditable() to select whether editing happens on single click or double click.

We use double-click to edit all our labels. However, we have not found way to set this behaviour on Slider labels. Is this possible? If not, I would like to request this feature. Being able to obtain the label from the slider component would perhaps be enough, so that the property can be set from outside?

 


#2

The following works for me:


class SliderDblClickLookAndFeel : public LookAndFeel_V3 {
public:
    Label* createSliderTextBox (Slider& s) override
    {
        Label* l = LookAndFeel_V3::createSliderTextBox (s);
        l->setEditable (false, true, false);
        return l;
    }
};

and then in the constructor of your editor:

slider->setLookAndFeel(sliderDblLookAndFeel = new SliderDblClickLookAndFeel());

#3

Thanks Fabian! This does indeed resolve our problem.

 

 

 


#4

Thanks Fabian! It’s useful!