Incrementing a slider

Hello,

I would like to move a slider to the left or to the right with + or - buttons.

I would like the value of the thumb position to be between 1000 and 2000 and increment by 5 the value of the thumb position each time I press a button.

here’s an example :

Increment_Slider.aia (2.1 KB)

blocks

When i press the button +, it increments by 5 but when i press the button -, it decrement by -10, although the blocks are the same either way.

Why is that ?

If you are asking for help, I recommend you to make it as easy for others to be able to help you …
You probably will get more feedback then…

which means in your case post a screenshot of your relevant blocks…

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc… this takes time, and most people will not do that…
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

I edited my post to include the blocks as an image.

Thank you for your input.

see this explanation by @Boban from the old forum https://groups.google.com/d/msg/mitappinventortest/e-64Ldc1qbE/KK-en28sCAAJ

min value -> max value
0 -> 100 each step has a value of 1 (100/100) = 1
0 -> 200 each step has a value of 2 (200/100) = 2
0 -> 255 each step has a value of 2.55 (255/100) = 2.55
0 -> 500 each step has a value of 5 (500/100) = 5

In your case when you have value 1-> 500 will be a little different as you already occupy 1 point/step, see the attachment…

as you get the wrong value when you try to go programmatically to 100, as I mentioned 100 “points/steps”
to position it so close to 100 it needs 20 “points/steps” 500/100 = 20

you already occupy 1 point/step and now it will be only 19 left, 499/100=4,99-> 19*4,99=94,81 plus the one we already occupied 94,81+1= 95,81

For my rgb app (youtube) I have manipulated the programmatic value from 100 to 255 so it gives me one step at a time…

in the link you also will find an example project to try…

Taifun

Try this: Increment_Slider2.aia (3.1 KB)

Thanks everyone for your answers !

I will use your solution @anke, thank you !

Hello Anke,

How did you get the slider to look like this ?

Is it an extension ? I can’t find it.

Select any other option than Theme “Classic” on Screen1:

grafik

Thank you !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.