Polling the mouse

J. Scott Saults saultsj at missouri.edu
Mon Feb 25 14:59:01 EST 2002

Fri, 22 Feb 2002 13:22:55 -0700
Scott Raney <raney at metacard.com> wrote

>But did you actually try this?  It *doesn't* work that way in either
>MC or HC now.  If you don't see it, try increasing the loop count (you
>may need to at one zero for HC, and about 3 in MC/RR ;-)
>My real question is, given that you're confused about this, how many
>other people must be, and if a lot, does this behavior really need to
>be preserved?

Scott & Geoff,
Sorry! I THOUGHT I'd tried it in HC, but I must have done something WRONG. 
HyperCard does return "down" after the mouse button has been clicked during 
the loop, even though it is actually up when the script gets "the mouse." 
Geoff 's step-by-step explanation  helped me see this. I'd not understood 
the implications of this exception to the way "the mouse" seemed to work. I 
apologize for posting my mistake, but thanks for the correction. The the 
mouse function seems to check some kind of event queue, rather than 
actually checking the state of the mouse button. Obviously, the mouse is 
more complicated than I thought, but maybe most people are not as easily 
confused as me.

During this subsequent testing, I discovered a couple of other curiosities, 
for what it's worth. SuperCard 3.6 SEEMS to behave more consistently than 
MC or HC, because it does, according to my tests, return "up" even after 
clicking during the loop of Scott's script.  Also, a slight modification to 
the 'put' command in Scott's script (below)actually causes HyperCard to put 
"down up" when the mouse is clicked during the loop and then not pressed 
again !  Weird.

on mouseUp
         get 0
          repeat for 10000 times
                 add 1 to it
         end repeat
         put the mouse && the mouse
end mouseUp

My 2¢?  Revolution should drop "the mouse" function, unless it can be made 
to work in a reliable, predictable way, as documented. I can live without it.

Scott Saults

More information about the use-livecode mailing list