How to reset a slider on double click?


so i have a slider with with std unique pointers for driveKnob and driveAttachment, also the parameters for “drive” and “Drive”, how do I make it so when the slider is double-clicked it sets it to a value i want?
Please can you provide some example code and explain well as i am new to this :smile:


Slider::setDoubleClickReturnValue() ?


thanks but how do i use that to reset the value of the drive slider?


You mean that you want that Slider to display a TextBox on double click ?


Nope, I have set some of the sliders to load up at 50% how do I set it to that value when you double click it?


slider->setDoubleClickReturnValue(true, 0.5) and then double click on the slider ?

EDIT oops I wrote this too quickly :slight_smile:


The signature is :

void setDoubleClickReturnValue (bool shouldDoubleClickBeEnabled, double valueToSetOnDoubleClick)


thanks! this works perfectly, for anyone else reading this it goes in PluginEditor.CPP


You’re welcome ! And it’s Jules who should be thanked since he provided the correct answer first :slight_smile:


i know but i didnt have a clue with what to do with it lol, what you sent actual made sense, so i guess thanks everyone