ThreeValueHorizontal listener for each value

Is there any way to add independent listener to each value separately in ThreeValueHorizontal style?

No, you use Slider::getMinValue() and Slider::getMaxValue()

https://docs.juce.com/master/classSlider.html#a2f8d0736f0fd0ebf95eeda2e1bd155bf

Rail

Hello, thanks for help.
So isn’t it possible to make value of slider depend on min value and max value? And vice versa, when I move middle value I want max and min move together.
OK. Maybe it would be easier if I just tell my purpose. I want to use it for zooming window. So when I slide max value down I want min value stay with no change, but middle value update to be always in the center between min and max. When I move min value I want max value stay but of course middle value update to be exactly in the middle. And finally when I move middle value I want all values move together.
So in other words I want min and max value to make zooming, but middle value just moving in the window.
Is there any class or method like that in the JUCE?
Best Regards.

So check the min and max values and update the values as you require
 so when the minValue changes
 set the Value for the middle thumb
 and when the max value changes set the value for the middle thumb. When you move the main Value, adjust the min and max values.

Rail

1 Like

:slight_smile: hey Rail_Jon_Rogut, but that’s what I am asking for, how to do that.
When I do that:

void sliderValueChanged (Slider *slider)
{
    if(slider == &wZoom)
    {
        wZoom.setValue(((wZoom.getMaxValue()-wZoom.getMinValue())/2.0)+wZoom.getMinValue(), dontSendNotification);
    }
}

Then the middle slider is blocked, I can’t even move that.

What are your actual values?

For code readability, please read:

Rail

I am not sure what you are asking for, as you can see in my code my middle value is always in the center between min and max value. But min and max can be any value in the range of slider.
So of course middle value should be blocked only in one situation: when min value is equal to min value of range AND max value is equal max value of range. But in all other cases middle value should work as I expect, but it’s always blocked.

It‘s blocked because every time you move it, sliderValueChanged() is called and resets the knobs value again. You should take care of that, by figuring out which of the three knobs actually was moved.

Yes that’s why I wanted to give separate listener for each min, mid and max value - like in topic.
I don’t know how to do that. I was wondering about slider.getMinValueObject() but not sure how to use it.

In your callback, you can call Slider::getThumbBeingDragged()

Returns a number to indicate which thumb is currently being dragged by the mouse.

This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for the maximum-value thumb, or -1 if none is currently down.

That’s the perfect answer. Thanks.
But why they called it here “Thumb”? In Silder style it’s threeValueVertica. When I want get vaule from max I just use getMaxValue. There is always keyword “Value” with min, max indicators. But here it’s “Thumb” with number indicator. It makes difficult to find it in documentation, at least for me.