Where to Put a Send Handler?

Sarah sarahr at genesearch.com.au
Thu Oct 3 23:17:00 EDT 2002

Your syntax is fine, but you need a way to start things off. If you 
want the handler to run when the stack is opened, put it in the stack 
script and make an openStack handler as follows:

on openstack
end openStack

If you want this to run when a particular card is opened, then do the 
same in the card script but with an openCard handler.

You could also forget the updateFiles handler altogether if you wanted. 
In your openStack (or openCard) say:
	send mouseUp to btn "Files"
Then at the end of the mouseUp handler, have a line that says:
	send mouseUp to me in 60 seconds

A couple of things to beware of: if you refer to a button or field and 
then change card or stack, the script may fail. Either cancel the sent 
message when leaving the card/stack or use complete addresses e.g. put 
"Test" into field 1 of card 3 of stack "Main"

Secondly, it is possible for sent messages to multiply. This can lead 
to strange effects if the repeating handler occurs more & more 
frequently. I prefer to cancel any existing messages before sending a 
new one. You can do this by looping through the pendingMessages and 
canceling any that come from the same object e.g. if your button ID = 
1003 then:
   put the pendingMessages into pendMsg
   repeat for each line L in pendMsg
       if item 3 of L contains "ID 1003" then cancel item 1 of L
     end if
   end repeat


On Friday, October 4, 2002, at 01:54  pm, Gardner, Joseph A wrote:

> Hello again, folks. I'm trying to write a simple handler to send a 
> mouseUp message to a button every 60 seconds. I've read the docs on 
> send vs. idle and believe I have the syntax correct:
> on updateFiles
>   send "mouseUp" to button "GetFiles"
>   send "updateFiles" to me in 60 seconds
> end updateFiles
> I got this structure from the docs. But where does it go? In the stack 
> script? In the card script? In the "GetFiles" button script? I've 
> tried all three, but the mouseUp never gets sent to the button 
> automatically. Entering the send in the Message Box works perfectly, 
> of course. Any suggestions on where to put a repeating timed handler 
> for best results?
> TIA...
> joe.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

More information about the use-livecode mailing list