How to reset a slider on double click?


#1

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:


#2

Slider::setDoubleClickReturnValue() ?


#3

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


#4

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


#5

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?


#6

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

EDIT oops I wrote this too quickly :slight_smile:


#7

The signature is :

void setDoubleClickReturnValue (bool shouldDoubleClickBeEnabled, double valueToSetOnDoubleClick)

#8

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


#9

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


#10

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