stopping an on-screen timer
Richard Gaskin
ambassador at fourthworld.com
Thu Jan 19 21:31:09 EST 2006
Sarah Reichelt wrote:
>> What is the best way to display a timer on the screen and then have it
>> stoppable?
>>
>> Something like the following would work for the timer
>>
>> on UpdateTimer
>> -- update the display
>> send UpdateTimer to me in 1 sec
>> end UpdateTimer
>>
>> My question is how best to stop the timer?
>>
>> Is it better to look for the UpdateTimer message in the pendingMessages and
>> cancel it?
>
> I prefer the pendingMessages method and I don't store the ID of the
> message and cancel that because I am never sure that catches all the
> messages. So just loop through the pendingMessages cancelling any and
> all that match your handler name.
Good idea -- here's a handler Peter might find handy:
--
-- fwKillPendingMessage
--
-- Cancels the message named in pMessage.
-- If pMessage contains the word "all" then
-- all pending messages are cancelled.
--
on fwKillPendingMessage pMessage
put the pendingMessages into tList
repeat for each line tMsg in tList
if (pMessage is "all") or (pMessage is among the items of tMsg) then
cancel (item 1 of tMsg)
end if
end repeat
end fwKillPendingMessage
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list