Changing Values While Left Click been Holded

Hi everybody,
I’ve been trying to change Coulours, Size… of my Sliders or Button only while i drag or hold the click.
I´ve been using this method (thanks to ImJimmi) doing Preset Buttons wich works perfectly:

addAndMakeVisible (m1Button);
m1Button.onClick = [this] ()

{
    mPurpleSlider.setValue (9.0);

};

Would there be a similar way doing it?
Forgive me i’m not doing right yet finding the right terms.
Thanks :wink:

For a slider, there are also callback methods you can set for onDragStart and onDragEnd, that’s where I’d start.

For a button, this question makes less sense – are you looking for a special behavior when the button is pressed, and then the user drags the mouse while holding the pressure?

1 Like

Hey Thanks for fedding back,
Well for the button i would like to print image from memory while and just while the button is pressed…

Drag question was for sliders yeah, i’m going to check that onDragStart and onDragEnd method for doing so then, thanks a lot :wink:

OK, so if you want to do a thing when the button is pressed, then I’d suggest using juce’s ToggleButton, and then you can set & poll the button’s toggleState

1 Like

how ok, thanks benvining you’ve made my day!

1 Like