# Min/Max Values of Knobs/Sliders



## thelasthaven (Mar 24, 2018)

Hi everyone,
I am trying to create a script where I should adapt knobs/sliders for different tasks.
Is it possible to change min/max values of GUI units *not* in "on init" callback?

I have something like this:

```
on init
  declare ui_knob $knob1 (0, 1000000, 1)
  <other parts of the script>
end on

<other parts of the script>

on ui_control (<another control>)
  set_control_par (get_ui_id ($knob1), $CONTROL_PAR_MIN_VALUE, 1)
  set_control_par (get_ui_id ($knob1), $CONTROL_PAR_MAX_VALUE, 3)
end on
```

Kontakt doesn't show errors in the code and doesn't change min and max values. Everything else works correct.


----------



## EvilDragon (Mar 24, 2018)

No, that won't work.

Use math to scale the knob values to the range you need.


----------



## EvgenyEmelyanov (Mar 24, 2018)

It does not work, Serega. I have no idea why. But you still can use get_control_par to get min and max values as I remember.


----------



## EvilDragon (Mar 25, 2018)

It never was intended to work. You can only GET the min/max values via get_control_par(), you cannot SET them. That was a documentation error.


----------



## EvgenyEmelyanov (Mar 25, 2018)

EvilDragon said:


> That was a documentation error.



In your opinion, why did NI not fix it?


----------



## Tod (Mar 25, 2018)

I'm not aware of this error, but you can easily setup minimum and maximum controls.

What exactly are you trying to set the Min/Max values for?


----------



## EvilDragon (Mar 25, 2018)

EvgenyEmelyanov said:


> In your opinion, why did NI not fix it?



It was never intended to work in the first place, you are not supposed to change the min/max range of a control! It would create far too many problems and add a lot of pitfalls during programming. KSP is a static language, so UI control value ranges are not supposed to be dynamically adjustable.


----------



## roq (Dec 13, 2020)

EvilDragon said:


> It never was intended to work. You can only GET the min/max values via get_control_par(), you cannot SET them. That was a documentation error.



Hi, can't find the reference for getting min and max values for a slider via get_control_par.


----------



## roq (Dec 13, 2020)

ops found it, thanks


----------

