Looking for a Slider::isDragging()


#1

Currently I'm having to do:

    Slider scrubber;
    bool isDragging = false;
    void sliderDragStarted(Slider* s) { isDragging = true;  }
    void sliderDragEnded  (Slider* s) { isDragging = false; }

    void timerCallback() {
        if (mySynthPlayer.isPlayingMidifile() && isDragging)
            scrubber.setValue(synthPlayer.getMidifileProgress());
    }
    void sliderValueChanged(Slider*) {
        synthPlayer.setMidifileProgress((float) scrubber->getValue());
    }

It would be nice if I could simply do:

Slider scrubber;

void timerCallback() { 
    if (mySynthPlayer.isPlayingMidifile() && scrubber.isDragging())
        scrubber.setValue(synthPlayer.getMidifileProgress()); 
} 
void sliderValueChanged(Slider*) { 
    synthPlayer.setMidifileProgress((float) scrubber->getValue()); 
}

Am I missing something?

π
 


#2

Wouldn't getThumbBeingDragged()>=0 do the trick?


#3

Sweet, thanks!

π