Hello,
I’m new to MIT App Inventor, and I’ve found many solutions to my problems thanks to this forum. A big thank you to the community for all the valuable information shared.
Unfortunately, I’m stuck on one point. The question has already been asked, but I don’t quite understand the answer.
I have a slider with values ranging from 0 to 255. I’d like to click a "+" button to increment the slider by 1 and a "-" button to decrement it by 1.
I’m facing the same issue as in the following link:
When I click "+", there’s no problem. However, when I click "-", the slider decreases by 3 instead of 1.
After some research, it seems that the slider decreases by 2.55 at a time, according to this source :
https://groups.google.com/g/mitappinventortest/c/e-64Ldc1qbE/m/KK-en28sCAAJ
ex.
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) = 5In 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,81For my rgb app (youtube) I have manipulated the programmatic value from 100 to 255 so it gives me one step at a time..
/Boban
Anke provided a solution, but I’m having trouble understanding it and adapting it to my case :
Increment_Slider2.aia (3.1 KB)
Could someone please clarify this for me? My sliders have different value ranges:
The RGB sliders go from 0 to 255,
Slider A goes from 0 to 170,
Slider V goes from 0 to 1000.
Thank you in advance for your help!
I forgot: is it possible to speed up the value change by holding down the - or + button, instead of having to click to add or subtract 1 each time?
My aia :
Slider255.aia (73.4 KB)