pendingmessages

Klaus Major klaus at major-k.de
Wed Jun 18 11:15:00 EDT 2003


Grüezi Martin,

> hi
> What does the following script do precisely?
>
> on mouseup
> repeat with i = 1 to the number of items of the PendingMessages
> cancel (item i of the pendingMessages)
> end repeat
> end mouseup

Actually it should read:

on mouseup
   repeat for each line L in the PendingMessages
     cancel item 1 of L
   end repeat
end mouseup

The pendingmessages are actually a list of all messages that are qeued 
by the
"send...in..." command and are waiting to be executed...

Each line of this list has 4 items in it.

1. the id of the message, THAT (id) can be cancelled with the 
"cancel..." command
## see below for an example...
2. the time (in long seconds) when the message should be
3. the name of the message and
4. the name of the "target" object

> Does this script empty the PendingMessages  and

see above...

> can a command after this script be executed?

Sure, but no pending message, they all should be dead now ;-)

> I use this script to stop a timer (send command / updateclock). If the 
> time
> given is over the timer should be stopped and the user should be 
> brought
> back to the startscreen.
>
> Most times the timer actually stops, but in about 10 times it's once 
> that
> the timer isn't stopped.

???

Hmm, can you post the actual script that "sends" the message?
It should work, but maybe you should try the syntax above,
it may already solve your problem...

> Can anybody comment on this and help me?

see above...

But you can specify what message you wnat to cancel.
Sometimes it may not be wise to cancel ALL pendingmessages ;-)

Like this:

on mouseup
    global my_msg_id
    send "yadda" to btn "geez" in 5 secs
    put the result into my_msg_id
     ...
end mouseup

And your personal cancel routine:

on mouseup
    global my_msg_id
    cancel my_msg_id
end mouseup


You get the picture... ;-)

> Martin

Hope that helps...


Regards

Klaus Major
klaus at major-k.de
www.major-k.de




More information about the use-livecode mailing list