Hi, I'm new.
I know this doesn't exactly fit the forum , but I'm frustrated to all hell and there doesn't seem to be anywhere else.
I'm looking for a clock. Specifically, a simple timer which gets date and time and displays it in a label, updating automatically every second. Simple right? That's what I thought, until I realized that if I don't have "wait 1 second with messages" in the loop, it'll just take up all the cycles and won't let you do anything. However, if I do include this line it'll run fine...for a while. It doesn't seem to follow any particular pattern but every once in a while my program will just stop responding. Killing the process (Ctrl . ) will highlight "wait 1 second with messages".
In other words it's flawed but nothing else seems to work. I've looked for a clock/timer function all over the net...so far nix.
Help?
Clock
Moderators: FourthWorld, heatherlaine, Klaus, robinmiller
Hi squirly,
try switching to a send in time construct:
You can now start and stop the clock by clicking on the button.
Hope this helps,
Malte
PS:
If you want to learn more about timers and a lot of other stuff, you might want to check out the free eBook I wrote:
http://www.derbrill.de/tutorials_e.html
All the best,
Malte
try switching to a send in time construct:
Code: Select all
-- you need a stack with a button and a field called "myField"
-- in the button
-- simple clock
on mouseUp
set the flag of me to not the flag of me
if the flag of me then startTimer
end mouseUp
on startTimer
put the long time into field "myField"
if the flag of me then send startTimer to me in 1 second
end startTimer
You can now start and stop the clock by clicking on the button.
Hope this helps,
Malte
PS:
If you want to learn more about timers and a lot of other stuff, you might want to check out the free eBook I wrote:
http://www.derbrill.de/tutorials_e.html
All the best,
Malte
I strongly recommend to use a timer as described above. You can make it constantly running by calling the timer on openCard / openstack.
In the card script:
This way it will start running when the card is opened and stop when you leave the card.
Hope this helps,
Malte
In the card script:
Code: Select all
on openCard
set the timerFlag of this stack to true
startTimer
pass openCard
end openCard
on startTimer
put the long time into fld "myField"
if the timerFlag of this stack then send startTimer to me in 1 second
end startTimer
on closeCard
set the timerFlag of this stack to false
repeat for each line theLine in the pendingmessages
if "startTimer" is in theLine then cancel item 1 of theLine
pass closeCard
end closeCard
Hope this helps,
Malte