Slider suggestions/bugs


#1

Hi There,
Just three suggestions that might improve the slider class.

  1. Add a function with which you can retrieve the the handle being dragged.
    Right now when ‘sliderValueChanged()’ is called there is no way to retrieve which of the possible three handles is being dragged.

  2. IncDec interval
    The interval value which you can set with ‘setRange’ enables you to set the increment which is used when pressing the +/- buttons. However it allways rounds the value to a whole number. Which is not allways what you want.
    So an option whether the interval actually constrains the value would be nice, something along these lines. setIntervalConstrainsValue(bool constrain)
    Right now there is no way to make an inc/dec slider which accepts any number (within the range of course), without setting the interval to 0, which will deactivate the +/- buttons.

  3. IncDec style drag
    When dragging the +/- buttons to change the values the drag starts after the distance of the mouse changed at least 10 pixels. Which is good , but this 10 pixels is not taking in account when calculating the new value. Because after 10 pixels are dragged, the value first makes a big jump. So the 10 pixels have to be subtracted from the dragdistance again.

I understand this is not top priority but maybe this post helped you put up up to your todo list :wink:
And there are just minor changes.


#2

Thanks. Not sure what you mean in your second point though - it doesn’t round to a whole number, does it?


#3

Hi Jules,
No it rounds it to the interval.

Example:
I have a Bpm spinner.
bpmSpinner->setRange (1, 500, 1);
I can manually alter the Bpm by typing a new value or using the ± buttons.
I can also tap a new value.
But the increment of 1 means that it allways rounds any value to a whole number. When the interval is 0.5 it allways is a value like 110.5 or 130. But no other values are possible.

Cheers
Edwin


#4

Oh, right, I understand now. Sorry, I was being a bit slow on the uptake there!

Ok, It’s a good point, and should certainly be added. That slider class has grown fatter and fatter over the years…


#5

Yes i know… it’s quite a piece of code…
But i think it’s quite powerfull.

Cheers
Edwin


#6

[quote=“gekkie100”]Hi Jules,
No it rounds it to the interval.

Example:
I have a Bpm spinner.
bpmSpinner->setRange (1, 500, 1);
I can manually alter the Bpm by typing a new value or using the ± buttons.
I can also tap a new value.
But the increment of 1 means that it allways rounds any value to a whole number. When the interval is 0.5 it allways is a value like 110.5 or 130. But no other values are possible.

Cheers
Edwin[/quote]

BTW Jules how would you implement a numeric spinner label where one can drag each decimals separately? or at least raw vst fine tne using the decimal seprator.

It requires to know the exact location of each glyph and I don’t know exactly where to start.

thanks


#7

Yeah, that’d be fun to do… I guess you’d need to use a GlyphArrangement to find the extents of each character.