Best way to set up an idle timer - not like this

Sarah sarahr at genesearch.com.au
Sun Aug 17 18:55:00 EDT 2003


> Wait! What seemed to be working at first is not. It seems okay until 
> you start examining the pendingMessages. For some reason the sent 
> messages start queuing up rapidly as soon as you start mousing around 
> in the stack. Obviously the cancel command in the resetLogout handler 
> is not getting all of the pending messages. But I can't figure out 
> where all of these pendingMessages are coming from.
>> on resetLogout
>>   cancel item 1 of last line of the pendingMessages
>>   send "logoutQuery" to stack "chinpr" in 5 * 60 seconds
>> end resetLogout
>>
Other people have suggested storing the result of the "send" and using 
that as a cancel parameter, but I prefer to be more heavy-handed than 
that, as I find that this still leaves the possibility of spawning 
multiple messages:

Put the following handler in your stack script and in resetLogout, 
replace the first line with:
	cancelMessageName logoutQuery

on cancelMessageName handlerName
   put the pendingMessages into pMess
   repeat for each line p in pMess
     if item 3 of p contains handlerName then cancel item 1 of p
   end repeat
end cancelMessageName

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/




More information about the use-livecode mailing list