Another slider suggestion -> pure label style


#1

A slider-style which is a pure label, where you can drag vertically, to change the value.
(Like the logic region parameters)

Implementation should not be to difficult, MouseListener on the valueBox for catching mouseDrag -> use the same drag logic from RotaryVerticalDrag


#2

Doesn’t Slider (Slider::LinearBar, Slider::TextBoxBelow) do that?
Like the SliderPropertyComponent in Projucer…


#3

No, but you give me a good hint. :slight_smile:
LinearBarVertical should working (for dragging vertical), and then disabling the slider-painting via LookAndFeel.
But there is one problem, the drag is relative to the slider height (to fast), so there must be an option to change the factor
(but, i will try to override the mouseDrag, modificate the mouseEvent and call the ancestor function … )


#4

See How To Make Click&Drag Number Box Slider (Without the Slider)?

Rail


#5

I created my own non-Slider based class for this. Because when based on a Slider, it was also not possible to have all of these:

  • click and drag over a bigger range than the height of this component.
  • click to edit.
  • mouse wheel support.

I might have overseen something and it could be possible, just sharing my observations from the past.


#6

I can drag outside the Label area and also use the scroll button (if my mouse had one… but I can drag my finger up and down my mighty mouse which is the same thing). I just didn’t implement double click to edit… but that could certainly be added simply.

Rail


#7

For these kind of controls, I just put a knob in and set the alpha to 0, and then in Paint(), ask for the bounds and the value of the knob, and use that to draw the text. No need to make it complicated, and you get all the normal mouse controls then.