Slider - how to check if slider is dragging or not?


#1

Hello,
I have stupid problem. Not sure how to indicate that Slider is stopped dragging.
There is nice method Slider::isMouseOverOrDragging() but it indicate when mouse is over slider, and I don’t need that. I want indicate only when it is dragging.

I also tried to create bool isDragging variable that is set to true in listener sliderValueChanged (Slider *slider). But then, where to change it to false when it’s not dragging?

I tried also to create myOwnSlider inherited from Slider and override methods startedDragging() and stoppedDragging(). But I need to call them somewhere. So that is the same situation like with bool isDragging: I can call startedDragging() in the sliderValueChanged. But where to call stoppedDragging()?

For any help thanks in advance


#2

Aha, I’ve just figured out, that startedDragging and stoppedDragging is called automatically, I don’t need to call them by myself. Great. So there is no problem.


#3

Oh sorry, I still have one question. Do I really need to create myOwnSlider inherited from Slider just to change (override) startedDragging and stoppedDragging?
Can’t I just change that behaviour for standard Slider with some lambda function or something like that?


#4

Slider has :

std::function< void()> onDragEnd

You can assign a lambda into that.


#5

thanks