Click anywhere linear slider inc/decrements value?


#1

I would like to click on the slider bar (the non-thumb part) so that the slider value increments/decrements by the step-size set in setRange.

Clicking to the right of thumb would increment, to the left of thumb would decrement.

Is this possible?

(So the behaviour would be similar to an OS scrollbar, where you can page down if you click below the handle)

Many thanks in advance!
John.


#2

Hi,

I had a quick look into it and unfortunately there seems to be no easy way to accomplish this at the moment. The parts of functionality that you would need here are buried quite deep inside the Slider implementation.

The Slider class is not ideal in many aspects and there is a chance that we will refactor it at some point in the future. Until then - unless anyone else has a better idea - I would suggest that you take a look at the mouseUp/mouseDown implementation in Slider, and at the behaviour for SliderStyle::IncDecButtons (which already does what you want, but unfortunately with extra buttons) - maybe it can be done by combining the code in there?


#3

How about a ScrollBar with your own LookAndFeel?

Rail


#4

Thanks for the replies!

I think both solutions would be above me right now. I will take a look when I gain more knowledge.

All the best,
John.