Message order ( was send ___ to ...)

Dar Scott dsc at swcp.com
Tue Apr 23 18:25:00 EDT 2002


Warning:  THIS SCRIPT WILL DELETE THE *NEXT* CARD!

Here are some scripts that illustrate what handler is executed 
next.  (It does not consider wait...with messages.)  On a test card 
you need button "order test", button "other button", and  field 
"Report".  You need a couple tiny handlers in the stack script.  
You also need some cards  behind this one to delete.  Clicking 
button "order test" will delete one card.

Button "order test"--

on mouseUp
   put empty into field "Report"
   send "log one" to me in 0
   send "log two" to me
   delete next card
   open socket to "127.0.0.1:12345" with message openCallback
   log "Click on other button NOW!."
   wait for 4 seconds  -- Time for you to click on button "other button"
   log "Don't click now."
   send "log three" to me in 0
end mouseUp

on openCallback socketID
   log "openCallback"
   close socket socketID
end openCallback

on socketClosed socketID
   log "socketClosed"
   close socket ocketID
end socketClosed

on socketError
   log "socketError"
   close socket socketID
end socketError


Button "other button":

on mouseUp
   log "other button"
end mouseUp


Stack:

on log s
   put s & linefeed after field "Report"
end log

on deleteCard
   log "card deleted"
end deleteCard

Here is the result:
2
card deleted
Click on other button NOW!.
Don't click now.
1
socketClosed
3
other button

This means...

1.  Executing a custom command occurs in line, even with "send to 
me" (without time).
2.  Some Revolution messages such as socketClosed are queued the 
same as "send socketClosed to me in .2 seconds".
3.  A handler called as result of command like "delete next card" 
will be called immediately.
4.  A handler called as result of an "event" (I'm not sure whether 
I got the right jargon) such as a mouse click is called after ready 
messages in pendingMessages().

I think one can guess which Revolution messages fit into which of 
2, 3 or 4, but there might be some surprises.

Dar Scott




More information about the use-livecode mailing list