![](/s/cache/f9/ce/f9ceaffaa46f04c5dc2a0279430af544.png)
0
Beantwoord
Countdown Timer
Khurram Masud 9 jaar geleden
in iRidium Script
•
bijgewerkt door Ekaterina (head of support) 9 jaar geleden •
1
Timer.irpz
Hello,
I am trying to insert a countdown timer in the application. When i press the button, the countdown starts from 60 Secs to 0 Secs.
i have tried it using the string 'GetState.Text = 60' then 'GetState.Text = 59' and so on... but i need to put delay of 1 sec in between, how is it possible?
Also, Is there any other way of doing this?
Please reply
Thanks,
Khurram
Hello,
I am trying to insert a countdown timer in the application. When i press the button, the countdown starts from 60 Secs to 0 Secs.
i have tried it using the string 'GetState.Text = 60' then 'GetState.Text = 59' and so on... but i need to put delay of 1 sec in between, how is it possible?
Also, Is there any other way of doing this?
Please reply
Thanks,
Khurram
Antwoord
![](/s/cache/89/03/8903776643aca636d40ef0a4dfeb4ff2.png)
0
Antwoord
Beantwoord
Ekaterina (head of support) 9 jaar geleden
![](/s/attachments/15553/1/1/86866004fc9b77b64f0aebf1100b0f16.png)
![](/s/cache/89/03/8903776643aca636d40ef0a4dfeb4ff2.png)
Antwoord
Beantwoord
var counter; function count () { // stop interval if it has been started before IR.ClearInterval(counter); //start value var time = IR.GetItem("Page 1").GetItem("Item 1").GetState(0).Text = 60; function count () { //if time > 0 then subtract 1 and send to text field if (time > 0) { IR.GetItem("Page 1").GetItem("Item 1").GetState(0).Text = --time; } else { // stop subtracting if time <=0 IR.ClearInterval(counter); }; } // start function count every 1000 ms (1 s) counter = IR.SetInterval(1000, count); }you can start the timer with Script Call command:
![](/s/attachments/15553/1/1/86866004fc9b77b64f0aebf1100b0f16.png)
Customer support service by UserEcho