Polling the mouse

J. Scott Saults attgenmail at moago.org
Fri Feb 22 14:22:01 EST 2002


At 10:51 PM -0500 2/21/02, Scott Raney <raney at metacard.com> wrote:
>I didn't check SC, but HC definitely does not work the way you say.  Try it
>yourself and see.  Put the following script in a button, then click to
>run it and click again before the repeats finish (you may need to
>adjust the count depending on the speed of your system):
>on mouseUp
>   get 0
>   repeat for 10000 times
>     add 1 to it
>   end repeat
>   put the mouse
>end mouseUp
>
>It's compatibility at that level that's hard to do, convenient as it
>might be for some things.
>   Regards,
     Scott

Evidently, I misunderstood your  original post.  I  afraid I don't 
get the point of this post or script, either. I'm sorry to be so 
dense.  It seems to me, in HC, that your script calls the mouse 
function once, after the repeat loop has finished its 10000 
iterations. If the mouse button is down when that occurs, then "down" 
appears  in the message box.  If the mouse button is up at that 
moment,  then  "up" appears  in the message box. If I press the mouse 
while the loop is still being executed, but then release it before 
the loop is finished, then "up" appears in the message box.  This is 
what I expect, and this seems to be what happens. If, on the other 
hand,  "put the mouse" is executed WITHIN the loop (below), then 
"down" appears in the message box whenever the mouse is being 
pressed, and "up" appears whenever it is not being pressed, until the 
repeated put's have ended.

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

So, it seems to me  that HyperCard IS returning the actual state of 
the mouse button, up or down, whenever the
  mouse function is called within the handler. This is all I meant to 
say.  Is this not true?  Obviously, either  I've not expressed myself 
clearly, or I've  misunderstood  the point of this debate, or both. I 
certainly apologize for adding my confusion to this discussion.

J. Scott Saults



More information about the use-livecode mailing list