Good evening all,
I need your help again, please.
I am doing -as you can read in the Title- an app with a countdown slider; it works... well, not bad but I see that the slider has not an uniform movement, percent by percent or second by second, I mean, it moves whitout order, one time it moves in 10 seconds, another in 40 seconds... well, a disaster!
Do you think is normal this behaviour? Could it be caused by the slider size (90% of the HorizontalArrangement layout). Can I do something to improve it?
Thank you very much in advance,
Joaquín.-
P.S.: I re-send the image because the first had a mistake.
1 Like
Anke
June 19, 2021, 4:46pm
2
How many seconds should be counted down?
See e.g. here:
The app is truncation decimals.
The first time I trigger the function it correctly display 5.5556
When I add 5.5556 to that, it displays 10.5556. Adding 5.5556 to that gives 15.5556.
Does the slider thumb position value get truncated automatically?
[blocks]
To make it short: The slider distributes 100 to the respective interval [0, 100], [0, 10], [0, 1] and seems to be therefore rather unsuitable for your purposes.
1 Like
Hello, Anke.
The countdown must works from 30:00 minutes to 00:00.
I read previously the article that you tell me, but I don't find explanation to the trouble that I have presented, because, as I said, the behaviour is different every time, not ever the same.
Thank you for your help. Best regards,
Joaquín.-
1 Like
Anke
June 20, 2021, 9:05am
4
Something like this?
(I set the duration to 1800 sec = 30 min, using a ListPicker in one of my old projects)
1 Like
Yes, Anke, this is exactly what I want to see, a uniform rythm of the slider, without nonsense jumps, like my app do. Do you mind to teach me how you did it? Because there is one thing in my app that I don't understand: I'm sending every second the Slider1.ThumbPosition value (I think it):
So, why it doesn't take them? Why these horrible and nonsense jumps of the slider?
Thank you very much one more time for your effort and for your patience whit me. Best regards,
Joaquín.-
Anke
June 20, 2021, 4:52pm
7
Post the aia. I can take a look.
Here it is.
Thank you very much again, Anke. Best regards,
Joaquín.-
MIT_AI_2.aia (5.0 KB)
Until now, the Slider is always divided into 100 positions, this produces those jumps.
We hope this changes in future updates.
opened 04:17PM - 15 Mar 21 UTC
enhancement
status: needs discussion
feature request
affects: ucr
**Describe the desired feature**
The Slider component maps the min/max valu… es into the range 0-100, so if you have a range that does not easily map into that range the values reported can be off. For example, if you have min/max of 0, 200, the slider will only report values in steps of 2. The proposal would be for a new property on the Slider to control whether the values are mapped into 0, 100 or not.
**Give an example of how this feature would be used**
Consider a slider for picking an angle between 0...359. Each step on the slider will be roughly 3.59, but if you wanted to pick 60 degrees, for example, you couldn't.
**Why doesn't the current App Inventor system address this use case?**
The App Inventor system causes the problem by its design. This would give more flexibility to people that need it.
**Why is this feature beneficial to App Inventor's educational mission?**
Users may be surprised when they get values that make no sense due to the internal mapping that the Slider creates. This would make it easier for beginners/students to make use of this component.
Try this code
Instead of using Slider, you can use Canvas like in this example from @TIMAI2
1 Like
Thank you so much, Juan Antonio, for you help, I'll try it.
Recibe un cordial saludo,
Joaquín. -
TIMAI2
June 20, 2021, 9:01pm
11
Here a simpler method, using a label instead of a slider:
labelCountdown.aia (3.6 KB)
2 Likes
Anke
June 21, 2021, 6:50am
12
Here you go:
MIT_AI_2b.aia (73.8 KB)
Screenshot
Theme: Device Default
You might want to switch to Theme "Device Default":
3 Likes
Anke
June 21, 2021, 7:06am
13
That's why I posted the above link in post #2 .
Good idea @TIMAI2 !
We can also use several HorizontalArrangements with a background image.
bor_slider_automatic.aia (10.9 KB)
1 Like
Anke
June 21, 2021, 10:11am
15
But in your case the Label.Width (instead of Slider) only changes every 20 sec and not continuously, as with my approach (using a Slider).
Blocks
Btw, the same applies for @Juan_Antonio 's approach.
TIMAI2
June 21, 2021, 11:06am
16
Anke:
changes every 20 sec
every second
Admittedly, for longer durations, I could have used more mathematics to evidence a movement on each tick of the clock.
Juan Antonio, I'm doing something wrong, it doesn't work for me.
I'll insist.
Thank you so much for your help,
Un saludo,
Joaquín.-
Joaquin:
no me funciona
What code are you using? Upload your .aia
Anke
June 21, 2021, 12:06pm
19
I don't think that the behavior of the width of the label (e.g. for 30 minutes, what the user wants) can be mathematically circumvented. But I like to be surprised.
Anke
June 21, 2021, 12:11pm
20
Did you try my aia (→ MIT_AI_2b.aia (73.8 KB)?
If so, does it work for you the way you wanted?