[comp.sys.mac.hypercard] Setting the Mouse Location

psych@watserv1.waterloo.edu (R.Crispin - Psychology) (11/08/89)

I would like to have a script position the mouse/cursor to a specific
part of the screen but I can't figure out how to do it. Using "click
at location" does not actually move the mouse/cursor. It just pretends
to. Has anyone got an XCMD/XFCN to do this or another way that it can
be done.
 
Thanks in advance

Richard Crispin
Dept. of Psychology             Bitnet: psych@watdcs 
University of Waterloo          Unix  : psych@watserve1.UWaterloo.ca 
Waterloo, Ont.   Canada   N2L 3G1
(519)885-1211 ext 2879

bskendig@phoenix.Princeton.EDU (Brian Kendig) (11/08/89)

In article <67@watserv1.waterloo.edu> psych@watserv1.waterloo.edu (R.Crispin - Psychology) writes:
>I would like to have a script position the mouse/cursor to a specific
>part of the screen but I can't figure out how to do it. Using "click
>at location" does not actually move the mouse/cursor. It just pretends
>to. Has anyone got an XCMD/XFCN to do this or another way that it can
>be done.

It's actually quite simple to do this.  Just put a message up on the screen
asking the user to move the mouse to a certain location.  No XCMD's, no
XFCN's - piece of cake.

In other words, NEVER NEVER try to move the pointer for a user.  This is
tantamount to having the computer grab the user's hand and forcibly move it
to a certain location.  Any situation where you would need to do this would
better be done via another, more user-friendly method.

The only time when Apple has ever allowed this approach of moving the pointer
regardless of what the mouse is doing was a few years back when the journalling
capabilities of the Event Manager were in vogue.  However, all memories of the
journaller seem to have been swept under the rug - not even the Apple Tour
disks use it any more.

     << Brian >>

-- 
| Brian S. Kendig       |  I feel more like I   | bskendig                   |
| Computer Engineering  |  did when I got here  | @phoenix.Princeton.EDU     |
| Princeton University  |       than I do now.  | @PUCC.BITNET               |
| Systems Engineering, NASA Space Station Freedom / General Electric WP3     |

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (11/10/89)

In article <67@watserv1.waterloo.edu> psych@watserv1.waterloo.edu
(R.Crispin - Psychology) writes:
>I would like to have a script position the mouse/cursor to a specific
>part of the screen but I can't figure out how to do it.

In general, it's not a good idea for a program to move the pointer; the
user should always be in control of mouse movements. (See the Human
Interface guidelines.) There is no way to do it in HyperTalk, although
an XCMD might work.

If you want to simulate the pointer moving around and clicking items,
e.g. for a demo or tutorial stack, one way is to use a transparent button
with an icon the shape of the cursor you want. Hide the real cursor, then
show the button in the desired location and move it around by setting its
location property.
-- 
====== jeanne a. e. devoto ========================================
 jdevoto@apple.com  |  You may not distribute this article under a
 jdevoto@well.UUCP  |  compilation copyright without my permission.
___________________________________________________________________
 Apple Computer and I are not authorized  |        CI$: 72411,165
 to speak for each other.                 |  AppleLink: SQA.TEST

writer@neptune.UUCP (Writer) (11/11/89)

R.Crispin writes:
>I would like to have a script position the mouse/cursor to a specific
>part of the screen ... 

Although I agree with others that you shouldn't hold a user's hand, there
is a valid application for making the pointer look like it is moving, 
as in a demonstration of 'how to use this stack'.


I couldn't figure out a way to move the pointer, but I faked it...

- make a button icon (or steal one...) that looks like the pointer (or hand 
or whatever)

- attach it to a transparent button that is only just large enough to enclose 
the icon

- move the button around the screen, using 'set the loc of button n ...' 
  (I filled an invisible field with x,y coordinates and read them sequentially)

- OH YEAH!  Don't forget to hide the real mouse pointer by changing its icon 
  to a single lit pixel.  (Maybe you can have it completely blank, but I forget 
  the details)

Hope this helps...  Nigel (waterloo co-op at large)