sliderDragStarted() and sliderDragEnded() issues

Hi all-

I've run into a bit of a strange issue with some sliders I have implemented in a plug-in. I have subclassed Slider for a custom text slider, and I am trying to change the color of the text slider based on it's value. Whenever the slider is moved by the user, I have an actionListenerCallback() that sets the value of the slider, and then calculates and updates the color of the slider.

However, if I click on the slider and start dragging it, the drag stops shortly after I start dragging, and freezes there until i release the drag and try dragging again. Then the same problem persists.

After running with a debugger, it seems that the first time I drag the slider and then release, sliderDragEnded() is never called. Then, the next time I try to drag the slider, sliderDragEnded() is called before sliderDragStarted(). Does anyone know what could be the cause of this behavior? Is there a standard/better practice for updating slider colors during a slider drag?

Thanks,

Tom

Anyone have suggestions?

This is the kind of problem where you just have to roll up your sleeves and get your debugger going. Could be all kinds of things wrong with your code, it's not easy for us to guess what it might be.

The issue might come from the fact that you set the slider value in the ActionListenerCallback, while it is already being set internally in the Slider class when the user is dragging the handle. An ActionListenerCallback is somewhat unusual anyway, as there's the Slider::Listener class... I'd suggest to make your editor a Slider::Listener, register it with the slider in question, and then set the colour (not the value) of the slider in the listener callback.