I was hoping you could help me with timers?
I have a process thats already programmed and works perfect but I need to put in a timer that populates every 20 seconds. I know how to do using the wait statement but I need a stop button to interrupt this event.
Basically all the statements I have automated using repeat with but need to press a button to stop the process.
Repeat with x = 1 to 100
Do someting
wait 20 seconds
--- need interrupt here before next loop!!!!!!!!!!!!!
end Repeat
Thanks so much in advance for your help.
Mike
timer with progress bar?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 46
- Joined: Fri Aug 02, 2013 12:14 am
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: timer with progress bar?
Hi Mike,
You may use send command, a pendingmessage.
Something like that:
Please check "send" and "pendingmessage" in dictionary
For progressbar you need a startvalue and an endValue
Edit:
You may also use "wait 20 seconds with messages". In this case you get others messages
Best regards
Jean-Marc
You may use send command, a pendingmessage.
Something like that:
Code: Select all
on mouseUp
send "doMyMessage" to me in 20 seconds
end mouseUp
on doMyMessage
if the mouse is down then exit doMyMessage
send "doMyMessage" to me in 20 seconds
put the seconds
end doMyMessage
For progressbar you need a startvalue and an endValue
Edit:
You may also use "wait 20 seconds with messages". In this case you get others messages
Code: Select all
on mouseup
Repeat with x = 1 to 100
if the mouse is down then exit repeat
put the seconds
wait 20 seconds with messages
end Repeat
end mouseup
Jean-Marc
https://alternatic.ch
Re: timer with progress bar?
This works fine too:
First, create a hilite button and set the name of it to "stop handler"
Second, create a default button and set the script of it to:
Now, click the button and watch the message box.
You could stop the counter just clicking the hilite button.
Al
First, create a hilite button and set the name of it to "stop handler"
Second, create a default button and set the script of it to:
Code: Select all
on mouseUp
Repeat with x = 1 to 100
put the ticks && x
wait 1 seconds with messages
if the hilite of button "stop handler" then exit to top
--- need interrupt here before next loop!!!!!!!!!!!!!
end Repeat
end mouseUp
Now, click the button and watch the message box.
You could stop the counter just clicking the hilite button.
Al
-
- Livecode Opensource Backer
- Posts: 46
- Joined: Fri Aug 02, 2013 12:14 am
Re: timer with progress bar?
Thanks so much for the help. I got the project done thanks to all of your help and I really appreciate it.
Mike
Mike