Slider::setVelocityModeParameters


#1

I'm having some difficulty getting slider velocity mode to work. Don't get me wrong, it works, but just not all the time. The following works fine:


    slider.setRange(0, 1, .001);
    slider.setVelocityModeParameters(1, 1, 0.0, true);
    slider.setVelocityBasedMode(true);

 

If however I change the interval in setRange() to anything other than 0.001 it just seems to revert back to plain old slider mode. For example:

    slider.setRange(0, 1, .01);
    slider.setVelocityModeParameters(1, 1, 0.0, true);
    slider.setVelocityBasedMode(true);

I thought perhaps the interval parameter of setRange() might have some relation to the sensitivity parameter of setVelocityModeParameters(), but if it does, it is lost on me. What think ye?   

 

 


#2

I still can't get my head around this. A simple modification to the Juce demo(WidgetsDemo.cpp) illustrates the issue I'm having. 


    Slider* createSlider (bool isSnapping)
    {
        Slider* s = isSnapping ? new SnappingSlider() : new Slider();
        sliders.add (s);
        addAndMakeVisible (s);
        s->setRange (0.0, 16.21, 0.1);
        s->setVelocityModeParameters(1, 1, 0.0, true);
        s->setVelocityBasedMode(true);
        s->setPopupMenuEnabled (true);
        s->setValue (Random::getSystemRandom().nextDouble() * 100.0, dontSendNotification);
        return s;
    }

The above code works, and each slider is velocity sensitive. However, as soon as I change the range to anything below 16.21 the velocity sensitivity no longer works. If this is expected behaviour can someone point out why? 


#3

Gentle bump....


#4

The slider has a lower limit on when it decides to use velocity-sensitive mode - if the range is small enough that every possible value can be set by just straightforward absolute dragging, then it won't go into velocity mode.

I think someone else requested recently that this behviour should change.. Maybe that's a fair point.


#5

Thanks Jule and sorry for pestering. Ok, this makes aboluste sense now. Maybe this could be added to the manual for future clowns who fails to see why velocity mode isn't kicking in! 


#6

I support the idea that velocity mode should engage despite range values.