"Clamped" DzIntSlider isn't really clamped
Gordig
Posts: 10,053
I've got the following code:
var sld = new DzIntSlider( wDlg );sld.label = "On position";sld.min = 1;sld.max = 2;sld.value = 1;sld.clamped = true;sld.labelVisible = true;wDlg.addWidget(sld);
When I run the script, the slider starts with a value of 1 and goes up to 2, but 0 is still an option. How is that possible if the min is set to 1? Shouldn't the min be the lowest possible setting?
Comments
I just tried an enumslider and a floatslider, just to see how they worked. I could bypass this issue by just using an enumslider, but I'm still curious about the answer, because the floatslider didn't fully respect that clamped minimum value either.
If you set the min after you've set the max the minimum value is respected. Don't ask me why!
How frustratingly arbitrary. Thank you.
If you set a minimum which is illogical (not less than the maximum), DS assumes you made a mistake. Set the maximum first so that the minimum makes sense.
And if you ever want a negative maximum set the minimum first, so that there's room.