like pass, but without ending the handler

J. Landman Gay jacque at hyperactivesw.com
Thu Mar 1 11:33:15 EST 2007


Dick Kriesel wrote:
> On 2/28/07 3:27 PM, "J. Landman Gay" <jacque at hyperactivesw.com> wrote:
> 
>> The important part is the "wait <time> with messages", which allows user
>> input to occur simultaneously. That will allow you to put in a "stop"
>> button. But while "wait with messages" does allow the messages to
>> happen, it does not allow them to be acted on. They will pile up in a
>> queue until the loop is exited. Some of them, anyway. I think some were
>> just lost.
> 
> Jacque, could you please clarify this?  What's the difference between
> happening and being acted on?  If Rev loses messages, I'd like to
> understand, so I don't write code that's likely to fail and that cannot be
> debugged.  

I've partly misstated this and you probably don't have anything to worry 
about. The script I wrote was from quite a while ago, so I had 
misremembered what was in there. In the example I gave, though, checking 
for "the mouseclick" does remove all mouse-related messages for that 
click from the queue; you get no mousedown, mousestilldown, mouseup. 
Just the act of checking for a mouseclick clears the message queue of 
that mouseclick's related events.

The difference between a message happening (I should have said, "being 
sent") and being acted on is probably simpler than my awkward wording 
implied. When a user generates an action, the engine sends a series of 
messages about that action (unless a script has set lockmessages to 
true.) If there are handlers in the stack that trap and act on those 
messages, the handlers will be executed ("acted on".)

I just did a test of what I wrote and I was wrong about messages piling 
up in the queue when "wait with messages" is in the loop; they execute 
fine as Chipp found out. I went back and looked at my original script 
and saw that in the repeat loop I did *not* "wait with messages" after 
all. In a loop without the "wait with messages" call, event messages do 
pile up and remain unexecuted. But the "with messages" line prevents 
that from happening and it does act very much like multi-threading.

I'm not sure I've made things any clearer. ;)

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list