[comp.sys.mac.programmer] FAQ - how do I change the mouse's location?

jcocon@hubcap.clemson.edu (james c oconnor) (04/15/91)

Hi - I'm writing a stack which is to be used by complete novices
who won't go through "Introduction to the Mac", so they will know
very little of the interface.  In response, I've made my fields
select themselves when the mouse enters their rectangle.  The problem
is that when the user tabs to the next field, and the mouse stays in
the last field, after the user types their first character into the
new field, mouseEnter gets sent to the old field (why?  I don't know,
the mouse hasn't moved any!)  The only way I can think of changing this
is to set the mouselocation to be somewhere within the new field which
is being tabbed into.  Hence, my question.

If you know of a better way, or which system calls to make to move
the mouse I'd appreciate the help.  (I can do XCMDs, so the toolbox
calls are fine)

Thanks,
Jim

witt@reed.UUCP (Jeffrey Witt) (04/16/91)

In article <1991Apr15.150330.3085@hubcap.clemson.edu> jcocon@hubcap.clemson.edu (james c oconnor) writes:
>Hi - I'm writing a stack which is to be used by complete novices
>who won't go through "Introduction to the Mac", so they will know
>very little of the interface.  In response, I've made my fields
>select themselves when the mouse enters their rectangle.  The problem
Tisk. tisk, tisk.

>[question on how to change the mouse location]

The technique you describe is an Apple No-No (tm).  However, if you really
want to change the mouse location, try this:

Procedure SetMouse(where: point);
Const
  RAWMOUSE = $82c;
  MTEMP    = $828;
  CRSRNEW  = $8ce;
Begin
  LocalToGlobal(where);
  ptrL(RAWMOUSE)^:= where;
  ptrL(MTEMP)^:= where;
  ptrB(CRSRNEW)^:= byte($01);
End;

>
>Thanks,
>Jim

Note again that changing the mouse location (and messing with system 
globals, for that matter) is considered hostile behavior.

Jeff Witt
witt@reed.UUCP