"Activity" message ?

Jacques Hausser jacques.hausser at unil.ch
Tue May 19 02:47:51 EDT 2009


Thanks, Kay

I was one day out and I missed your message... Finally I did something  
simpler, with a command called in the scripts of every control:  
"resetTimer", which reinitialize the counter to GTimeLag seconds, and  
a "setTimeLag nseconds", called where necessary. It's not really  
elegant, but it's only one word in each script and it works fine, so  
I'll not change it now :). But I'll study your suggestion (I muss  
confess I never used the pendingMessages).

Jacques


Le 18 mai 2009 à 05:13, Kay C Lan a écrit :

> On Fri, May 15, 2009 at 11:02 PM, Jacques Hausser
> <jacques.hausser at unil.ch>wrote:
>
>>
>> Yes it is tempting. As the timer runs in the background, this front  
>> script
>> should reinitialize a GRemainingTime global (or a CP if you are
>> globalophobic - I'm not). But, depending of what the user is doing,  
>> I want
>> to set different values for the reinitialisation, therefore a  
>> second global
>> or CP...
>> I'll look. Many thanks anyway.
>>
>> Probably a little late, but what about handling this in reverse. In  
>> every
> user action script, start with a 'cancel' command and at the end of  
> every
> script finish with a 'send' command.
>
> The idea is that at the end of the user doing something, the script  
> will
> automatically instigate the reinitialisation in a given time, say:
>
> send myReinit to stack "myStack" in 300 sec
>
> At the beginning of a script where the user has done something, the  
> script
> will cancel the reinitialisation:
>
> cancel item 1 of the last line of the pendingMessages
>
> For different actions you can have different send in times, ie if it  
> opens a
> field full of text it might be 600 sec, but if it activates a 2 sec  
> sound
> bite you might send in 60 sec.
>
> The only tricky bit is that for the very first action there is no
> pendingMessage to cancel, and, although you theoretically should  
> never get
> out of sync it might be worthwhile using an all encompassing cancel
> function, something like:
>
> FUNCTION reInitMonitor
>  --if no pending messages, nothing happens
>   repeat until the pendingMessages is empty
>      cancel item 1 of line 1 of the pendingMessages
>    end repeat
> end reInitMonitor
>
> THIS ASSUMES YOU ARE NOT USING 'SEND' FOR SOMETHING ELSE!!!! If you  
> are,
> then you'd need to keep track of the send ID and only cancel the  
> appropriate
> IDs.
>
> So in summary:
>
> on mouseUp
>  --cancel any impending reinitialisation
>  reInitMonitor
>
>  --do all your stuff here
>
>  --set up a new reinitialisation
>  send myReInit to stack "myStack" in 300 sec
> end mouseUp
>
> Look in the Dictionary under, cancel, send and pendingMessages
>
> HTH
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

******************************************
Prof. Jacques Hausser
Department of Ecology and Evolution
Biophore / Sorge
University of Lausanne
CH 1015 Lausanne
please use my private address:
6 route de Burtigny
CH-1269 Bassins
tel/fax: 	++ 41 22 366 19 40
mobile:	++ 41 79 757 05 24
E-Mail:	jacques.hausser at unil.ch
*******************************************




More information about the use-livecode mailing list