Bug in Slider 0-1000?

So I have a Slider with Min-Max set to 0 and 1000. I have a Label whose value is updated when the thumbPosition changes. I have 2 buttons, one for increasing the value by 1, and one for decreasing the value by 1. The buttons update the the Label, as well as the thumbPosition. The Value is stored in a global variable (although using/not using the variable has not effect on the behavior).

Problem/Bug: at this slider resolution, the thumbPosition can only move by units of 10, and when I click the "IncreaseBy1" button, it updates correctly, but when I click the "DecreaseBy1" button, it skips down by units of 10 (once it has reached a multiplier of 10). For example, it'll update correctly 623, 622, 621, 620, and then after that it skips by 10's to 610, 600, 590, etc... The IncreaseBy1 button always works correctly. Wierd.

The only way I can get the behavior correct is to NOT update the thumbPosition when I click the Decrease button. This seems like a bona-fide Bug to me. What do you all think?

Hello David

I think that would only work if the Slider was 1000 pixels in length. Is it?

Edit: For example, if the range is 0 to 1000 and the length of the Slider is 200 pix, the actual increment of the thumb would have to be 0.2 pix for an input of 1. So the graphic can't be accurate.

No - it's set to 85% of the screen size. I understand what you're saying, but the slider does update correctly when using the button to increase the slider value by 1. It's the decrease button that it has a problem with.

Testing it here, I'm not sure it does David. Even if the thumb is moving by a fraction of a pixel, it would be pretty difficult to tell if that was accurate without physically measuring it after several increments.

To prove the point, try this example where the range matches the SliderWidth. If you increment it to half-way, your rule will show the thumb is at 50%. Plus and Minus inputs work as expected.

Slider1000.aia (2.4 KB)

We (Power Users) did advise you, in your other topic, that using the slider for a range of 1.0-100.0 showing decimal places would not work (even though you accepted a proposed workaround from another forum user, which set the range to 1-1000).

Suggest you use the canvas/ball solution offered in your other topic, and see how you get on with that.

I'm not using decimal places for the slider - the slider is simply 0-1000 min/max. That's why I started a new topic, unrelated to the first.

Chris- Your example works only because your slider itself isn't updating the label when you drag your thumb. Change the min/max to 0/1000, and add a label update on PositionChanged, and you'll see exactly what I mean.

Slider1000.aia (2.5 KB)

This shows the problem.

Tried it with a correction, working as expected.


So when you drag the slider it doesn't update the global var?

Your input is the buttons?

It's both. The user should be able to drag for large changes, and fine tune the value with small increments. Why doesn't the Decrease button work correctly (but the Increase button does) when your thumbPosition also updates the global var?

Here you have the solution.

Unfortunately, the resolution of the slider is set rigidly in the code to 100 points. It would be very easy to add an option to change the resolution by deriving a variable and the ability to modify it. Of course, for compatibility, set the default value to 100.
@ewpatton what do you think about it?

1 Like

Ok, so basically you're turning OFF the updating of the Slider.PositionChanged while the button executes its code? I'll see if I can add this to my project. Thank you!

Thanks for the discussion around this. I've decided to file a feature request.

Thanks Evan. Any chance you could also add an optional timer/clock directly into the slider itself? This way you could get more regular/consistent readings from it. Currently when I use the slider (and this may also have to do with the range mapping issues since my slider is 0-1000), I get some "wild" values in between the expected values. I've had to make a separate clock object because of this, which reads any changes to the slider position and updates the value correctly (I'm sending the slider value over Wifi). A timer-updater property built directly into the slider would be a helpful approach, imo.

The timer is not part of the slider and is unlikely to be part of it. If you need a clock for your functions, you are just using the clock component.

Yes, but since the slider outputs very erratic values, it would be helpful to have a clock option built into it (or something to "smooth out" the output noise).