Slider vs. mouse drag up/down

I want to have a Slider that is basically a Label which shows inside itself an integer value as a visible text: BPM slider which the user can slide up/down with a mouse or enter the BPM value using keyboard. Like in Ableton Live, etc.

When you click and drag that Slider up/down with a mouse the value should change accordingly.

I tried implementing this with the standard juce::Slider (Slider::LinearBarVertical type), but I ran into following issues:

  1. As the Slider has to be quite short in height (only one row of text high), the mouse drag changes the Sliders value from minimum to maximum in the span of the height of that Slider component. And as it’s height is just one text row high, that happens almost instantly.
  2. Using SetVelocityBasedMode(true) doesn’t fix the issue properly: trying to adjust 1-2 BPM up/down is really hard to get right, as either nothing happens or you end up overshooting your target value.

So what I would need is basically a LinearBarVertical Slider which reads the mouse like a rotary slider in such mode that it checks only how much the mouse has moved vertically, while ignoring the Sliders own physical size on screen.

What’s the easiest way to achieve this? Can the standard Slider be configured somehow to work like this or do I have to create the a completely new Slider from scratch?

I don’t think `LinearBarVertical` will work. You may use RotaryHorizontalDrag and then call `setMouseDragSensitivity()`.

BTW, the code display sometimes works sometimes not after a upgrade?, which is quite strange.