Mouse polling

Björnke von Gierke bvg at
Sat Mar 2 19:55:01 EST 2002

After reading the whole discussion on the "mouse" function twice, i 
still don't see exactly where the trouble comes from. Thus I wrote this 
long winded mail. Maybe im just too stupid (or my english isn't good 
enough) to understand where people have problems, but here is what I 
think the mouse SHOULD do:

if the mouse is down

true when the mousebutton is down when the script comes to the execution 
of the above line.

this automatically leads to the following:

repeat until the mouse is down
end repeat

This beeps repeatedly until the mouse is pressed while the script comes 
to the execution of the first line (because then: the mouse is down = 
true and the loop exists)
Note: Don't try the script. Would beep really often and scare your cat 
Also interesting: If you put this in a mouseDown handler it will not 
beep (or only once? not sure here), as the mouse is already down (unless 
you are a really astounding fast clicker (professional quake gamer?)).

I just don't understand how this can lead to any problem at all? A 
different mater is the following example:

repeat while the mouse is down
set the loc of field "grabMe" to the mouseLoc
end repeat

This will move the field around (kinda dragging) until you release the 
Maybe. As sometimes "the mouse" seems to "stick" to a certain state 
(good to know command-. in such cases!) Note that repeated clicking does 
not resolve the problem. Here seems to come something strange into the 
whole: Does the loop "forget" to check every round if the mouse is down? 
Does it repeat until it receives a mouseUp for speed purpose? Kind of  
cheating it would be, says Yoda. Or is it just underrun by the 
Quake-capabilities of the clicker? No one knows...
Note: If the Loop would have more commands in it (slowing it 
considerably down) the cursor would naturally leave the field behind, if 
you want to have live dragging, use the grab function instead! Also if 
you release the mouse under such slow circumstances but  click again 
before the loop checks the state of the "mouse" again it should still 
keep relocating the field.
But it doesn't! I tested it with wait,  and instead it sends you (once 
again) into endless dragging land.

So to me there seems a merely technical problem in the implementation of 
the "mouse" function, a bug. But Scott says that "the mouse" merely does 
strange thing to my computer, and thus should not be used. This is the 
point where I always get lost :-(
could someone (Scott) please explain to me (again) what the difference 
makes between the second and the last example and why that makes "the 
mouse" a not-so-well function, I mean it just checks a property!  /Me 
doesn't get it...

thank you
Björnke von Gierke

More information about the use-livecode mailing list