Slider ThumbPosition fed by external value fails

I try to position a slider based on a value coming from a Arduino controller via BT.
Communication is OK and the values that are sent by the Arduino are confirmed to be good in the list I produce after reception via BT.
Then … when I put that value into the sliders ThumbPosition, the value gets crazy. I.E. the incoming value is 50, what is left over in the ThumPosition is 48.45. Or from 54 become 51.8.
The deformation happens at the point tha value is transferred from the list into the ThumbPosition

When you take a look at the block whatch out for “Notifier_BT call” I used the present a message with 3 values: the value that came in via BT and that sits now in the list (item 4). The value as it is in the ThumbPosition of Slider_RED_top and that was set right before this message, and the the rouded value.
The last test showed me: “Top Red received: 54 Top Red ThumbPosition: 51.8 Round Top Red ThumbPosition: 52”
The goal is to have 3 times the same value: 54, of course.

Has anyone an idea what I’m doing wrong? Or an explanation what is going wrong? Remediation?

You do not show the settings you have for the slider…

slider

Try a double set of the slider thumbposition before showing the dialog

See e.g. here (maybe you find something useful):

A thin Canvas with a fat line makes a more accurate display.

1 Like

I’m not sure what you mean … however I discovered by accident that this way it works (look at the block)

… for some reason I can’t understand. To me it makes no sense at all.
I read all the references of Anke and I saw the video on youtube about the rgb sliders, but I could not find out how it’s made working correctly. I understand that sliders are default devided in 1/100, but I don’t understand the relation to what goes wrong in my case. And even worse … how it relates to enter twice the same number into ThumbPosition. It is really strange. For a programmer very confusing…
I like to see the code of the rgb video, I couldn’t find it.
The comment on the video says: “I have changed this setMax() value to 255 and by doing that I get increased or decreased steps by one…” but it doesn’t say how to do that.

Meaning ... ?

Meaning you have more control with a DIY ‘slider’ (or single bar bar chart)

You can change the range of the slider. For example, I changed this one to 0-255:

SliderRange

… so change the range of your slider to match the range of your values. Note that since the slider is intended to be an input device, it’s not overly suited to your task. Experiment.

Edit: I forgot that you can now omit the Thumb, making the slider much more suited to your task :grin:

SliderRange2

Here’s a sample …
https://groups.google.com/forum/#!msg/mitappinventortest/eA_T9NWTa6A/SZTS48_FAAAJ

and a better example:
Capture

progress_canvas.aia (2.8 KB) when slider1 positionchanged

The show_progress procedure should be draggable.

Thank you for all suggestions. I’ll take a look at it and perhaps adapt my app accordingly.

I made a small project “TEST_slider.aia” showing that something is wrong.
The project shows 2 sliders that are defined exactly the same way and I feed 1 slider (TOP) with a chosen value, ie 50 and the other one (BOTTOM) with twice the value, one after the other. As you can see in the block “When Value_btn click”.
You can see that the result is different, the TOP is wrong, the BOTTOM is correct.
You can move the sliders and you will see that the starting point of the slider has no effect. Only a second SAME value after the first gives you the right result. Push 2 time on the button, ie. to see that the TOP slider is correct now.
One can perhaps explain what the wrong values are, but can one explain why the re-entry of the same value is giving a correct result?
This looks like a nasty bug in my eyes. It makes no sense to me and I wonder what might be the reason. It’s hard to imagine that this behaviour is intentional.

After a review of the solution that is proposed, I think I can live with the bypass of entering the value twice. It is simple and easy to remember.TEST_slider.aia (2.8 KB)

Now, what I try to do in my project where I detected the issue, is to be able to control RGB values for LEDS via sliders on the smartphone and at another point in time, let the Arduino take the control over the LEDS. At some point the when I take the control back manually, the actual RGB values need to be transferred to the smartphone to set the sliders. At that point I could see that things were wrong because sometimes default values are displayed and not matching.
All part of a build for a nixie clock project.

As per:

Yes, I know, but shouldn’t that be reported as a bug? Or, is it already?

Some would argue there is no bug, others would say this is by design. There are only two outstanding open issues for the slider, both to do with colour…

I agree that it is no major issue, anyway. And there is a simple and easy bypass …
Case closed for me.
Thanks to everyone for the help … I learned a lot on the way!