The "Set Slider ThumbPosition doesn't work correctly


I use a slider with Min Max values set to 0 - 255
When I set the Slider-ThumPosition to a value and then I look at the Slider Thumbposition the value is not exactly the same. ( between 0 and -2 relative to the requested value.)
If I repeat the "set slider.thumposition" a second time with the same value, then it takes the right value.
To get around the bug I systematically double all calls to the function "set slider.thumbposition"

maybe it's a time issue. try to use a timer to wait some time, say 100ms, then set the slide thumb position.


Sorry, label1 is not used.

Put a value in TextBox1 between 0 and 255 (the min and max values off the slider1)

Click on OK

The value in TextBox1 is set to slider1.ThumbPosition.

Then the slider1.ThumbPosition is set to Label3.text.

So, the Label3.text should be idem to the value in textBox1, but it is not.

If I click OK a second time, the value of slider1.ThumbPosition is correct.
Today, in order not to have a problem, I set 2 consécutive times the slider.ThumbPosition.


Try these blocks and you might understand what I posted in post #3.

Actually, the issue here is that the Slider currently normalizes its values internally to a 0-100 scale, so the reason you're seeing it being off by up to 2 is because 2 is the integer division result of 255/100. This design decision made a lot more sense when phone screens were only 160 px wide but clearly don't hold up to more modern devices.

1 Like