Slider Snapping, Min, Max questions

Hey Jucers!

I’m really ashamed, but I’m completely lost in this Slider stuff. :smiley:

I have an AdvancedSlider class to set a few things easier. In most cases I’ll use it in four modes:

  • Linear for integers (snapping 1.0, it works)
  • Linear for floats (no snapping, it works)
  • IncDec for integers (snapping 1.0, it works)
  • IncDec for floats (no snapping, but I’d like to have for example 10.0 inc-dec when I click the buttons, but let the user to type the number they want)

I’ve seen two approaches:

  • setRange(min, max, step) - for IncDec floats it’s not an option
  • snapValue(value, dragMode) - this method just doesn’t run, and I don’t know why

Additionally is it possible to use setRange() with (-inf, inf, 10.0)? Or let’s say (0.0, inf, 10.0)? It looks like it’s not. IncDec mode works only when I use setRange, but I don’t want to limit the range, and for floats I’d like to use the step only for the IncDec buttons, but let the user to type they want (as I wrote above). It makes sense of course only for IncDec, for Linear I have to know the range.

Another question. Does Rotary has an option for infinite rotation? Apple has this kind of knob, that can turn round and round, and based on the direction and velocity of rotation it increments or decrements it’s value, but it doesn’t have a start and end position. Does this exist, or I have to write this kind of functionality myself, and hide the default UI?

Please help me! It’s a stable, node-based, multithreaded app, and I can’t solve my problem with a Slider… :smiley:

Thank you!

Hi Sesores,

Allowing the user to enter any value in the inc/dec slider’s text-entry box and having the buttons then increment or decrement that value by the step amount is a good suggestion, I’ll take a look at it. It’s not possible to set the Slider range using -inf or inf but you could use large enough values that it will have the same effect.

The rotary slider doesn’t have an infinite rotation option but it does have a velocity sensitive mode - check out the Slider::setVelocityBasedMode() and Slider::setVelocityModeParameters() methods.

Hope that helps,

Please consider that a feature request. I would have used it a few times already if there was such an option. It would be a cool addition :slight_smile:

1 Like