: More send in time
Dar Scott
dsc at swcp.com
Mon Jun 30 22:30:00 EDT 2003
On Monday, June 30, 2003, at 05:58 PM, Ken Norris wrote:
> OK, all the other scripts I've seen, including mine (except for the
> screwup
> of putting 'the mouse' instead of 'the mouseLoc' which is what I meant
> to
> say) all use 'the mouseLoc'.
I'm not familiar with all the concerns. I do know that there have been
some concern with 'the mouse'. Even though it might not be clear from
the doc, the behavior is much improved from my viewpoint.
From 'What's new.txt':
- The "mouse" function now reports the state of the mouse button at the
moment the function is called. Formerly, this function reported whether
the mouse button had been pressed since the current handler started.
(In general, it is recommended to handle the "mouseDown",
"mouseRelease", and "mouseUp" messages rather than check the state of
the "mouse" in a handler.)
So maybe the mouseLoc is discouraged, or maybe it has just been running
with the wrong crowd.
>
> So what is so bad about using it then, except for using it in a loop?
>
> I guess it's the loop that causes the tieup using it, which can be
> done away
> with by the 'send in time' routines. Is this true?
The send-in-time allows other things to be going on at the same time.
What did Harry Tuttle say? Get in, get the job done, get out. That
should be the task of every handler.
> Also, I'm totally ignorant of message ID numbers. How do messages get
> to
> have ID's?
Every message put into 'pending messages', the message queue has an ID.
If the message is created by send-in-time it is possible to get the
message by checking the result. In this case a non-empty value is not
an error, it is the ID. Save it away. The ID can be used to cancel a
pending message. The cancelled message is removed from the queue and
is not executed. It is possible to have more than one message pending
for the same handler. The ID makes them unique. The ID also shows up
as the first item in each line of pendingMessages().
When you order your pizza or ship your package, you get a receipt with
a number that allows you to track that. The ID is the same. You say
to send, "send off this message" and send will give you a receipt.
Dar Scott
More information about the use-livecode
mailing list