<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { margin-top: 0 ; margin-bottom: 0 }
 --></style><title>Polling the mouse</title></head><body>
<div>Jim Hurley wrote:</div>
<div><br></div>
<blockquote type="cite" cite><br>
> I regularly use "repeat until the mouseClick" without
the same<br>
> problems I experience with the mouse function. My question is:
Does<br>
> the advice to stay away from polling the mouse extend to the<br>
> mouseClick function as well? Scott has warned that the
mouse()<br>
> function may/will be discontinued. How about mouseClick()? Is it
also<br>
> in jeopardy?</blockquote>
<div><br></div>
<div><br></div>
<div>Scott Rainey wrote:</div>
<div><br></div>
<blockquote type="cite" cite>Yes.  The full list of functions to
avoid because they are deprecated is:<br>
the mouse<br>
the mouseClick<br>
the mouseH<br>
the mouseV<br>
the mouseLoc<br>
the optionKey<br>
the commandKey<br>
the controlKey<br>
<br>
And the very worst thing to do with any of these is "repeat
until<br>
<function>", which will condemn you to the fires of eternal
damnation<br>
in multiuser hell ;-)<br>
<br>
The last 3 can be safely acquired with "the keysDown", but
be careful<br>
to not sit in a repeat loop calling that or you may hang your app
or<br>
at the very least have the gods of multiuser development strike
you<br>
down.<br>
<br>
And while we're on the subject of bad technique that will cause
you<br>
grief at some point, also avoid using the following
messages:</blockquote>
<blockquote type="cite" cite>mouseStillDown<br>
mouseWithin<br>
idle<br>
<br>
That's it.  Not a long list, and in all cases it's very easy (I
would<br>
even in most cases say trivial) to do it the right way.  A small
price<br>
to pay for shrugging off the last of the circa 1984 single-user<br>
single-tasking design of MacOS and HyperCard.<br>
  Regards,</blockquote>
<blockquote type="cite" cite>    Scott</blockquote>
<div><br></div>
<div><font color="#000000">After 35 years as a professor of physics,
it has been my experience that trivial is in the mind of the
beholder.<br>
<br>
Scott is quite right is pressing *developers* not to anger the
"gods of multi-user development." But there is also another
class of user, one to which Run Rev is trying to appeal, and that is
the *student* who is using HyperTalk as a computer language--perhaps
as young as eighth grade. And this user would be programming in the
development environment and would be unconcerned with tying up the
CPU.</font><br>
<font color="#000000"></font></div>
<div><font color="#000000">For some time I have been using HC, MC
and/or RR to build Turtle Graphics into HyperTalk and allow grade
school students to use the package to program their own solutions to
problems in mathematics and physics. There are two areas in this work
in which HyperCard is quite superior to MC or RR. (And there are many
others, of course, in which MC and RR are infinitely superior to HC.)
The most serious problem is the glacial speed with which MC draws
images (in many cases this problem is lethal) and the second, and much
less important, is the problems students have in polling the
mouse.</font></div>
<div><font color="#000000"><br></font></div>
<div><font color="#000000">There appears to be no remedy in the offing
to the speed problem. However, regarding mouse-polling, my earlier
question dealt with the reliability and continued viability of the
mouseClick function.</font><br>
<font color="#000000"></font></div>
<div><font color="#000000">As an example, students create a button
which, when clicked, sends a satellite on its way into orbit around
the earth--leaving a line in its wake to show the trajectory. (The
student has programmed the turtle to obey the laws of Newtonian
gravity.) When the student is satisfied with the length of the
trajectory, he or she clicks again (anywhere on the screen) to stop
the process. This is accomplished with a "repeat until the
mouseClick" or "if the mouseClick then exit
repeat."</font></div>
<div><font color="#000000"><br>
So my question is three-fold:<br>
<br>
1. Is this a reliable operation given the current state of the MC
engine? That is, is there a bug similar to that in "repeat until
the mouse is down?"<br>
2. We know that we may lose the mouse() function in the future. Is
mouseClick vulnerable as well?<br>
3. If mouseClick will not be an option, what is the work-around so
that the student may click anywhere on the screen to exit a repeat
loop, and hopefully one which is simple enough for an eighth grader to
discover? (Since the student clicked the button to start the process,
it is more natural to click again to stop the process. It would be
awkward to have to move to the keyboard.)<br>
<br>
Jim Hurley</font></div>

<div>-- <br>
Jim Hurley</div>
</body>
</html>