[comp.sys.mac.programmer] moving mouse

dscheidt@van-bc.wimsey.bc.ca (Daniel Scheidt) (12/15/90)

How can I change the mouse location without moving the mouse?  How do
you change the current mouse position returned by GetMouse?  I need to
do this for a project using a track-ball.

  Thanks, please reply to the address below...

- Daniel
  djs@scheidt.wimsey.bc.ca
  

mxmora@unix.SRI.COM (Matt Mora) (12/18/90)

In article <945@van-bc.wimsey.bc.ca> dscheidt@van-bc.wimsey.bc.ca (Daniel Scheidt) writes:
>
>
>How can I change the mouse location without moving the mouse?  How do
>you change the current mouse position returned by GetMouse?  I need to
>do this for a project using a track-ball.

From the UMPG on page 21:

 by Chris Muir

procedure SetMouse (where: point);
  var
   LowGlob: integer;
   LowMem: ptr;
   PointPtr: ^point;
   finalTicks: longint;
  const
    {some dangerous low-memory-global equates}
   MBState = $172;      {byte}
   MTemp = $828;        {point}
   RawMouse = $82c;     {point}
   Mouse = $830;        {point}
   CrsrNew = $8ce;      {byte}
   CrsrCouple = $8cf;   {byte}
   Couple = $ff;        {value for CrsrCouple}
   Uncouple = $00;      {value for CrsrCouple}
 begin
  LocalToGlobal(where);             {Get ready to restore old mouse position}
  LowMem := pointer(RawMouse);      {point to low memory}
  PointPtr := @LowMem^;             {treat it as a point}
  PointPtr^ := where;               {store saved mouse position into it}
  LowMem := pointer(MTemp);         {point to low memory}
  PointPtr := @LowMem^;             {treat it as a point}
  PointPtr^ := where;               {store saved mouse position into it}
  LowMem := pointer(CrsrNew);
  LowMem^ := $ffff;                 {both CrsrNew & CrsrCouple}
  Delay(5, finalTicks);             {let the cursor catch up}
 end;       {SetMouse}




-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) (12/18/90)

dscheidt@van-bc.wimsey.bc.ca (Daniel Scheidt) asks:

DS> How can I change the mouse location without moving the mouse? 
DS> How do you change the current mouse position returned by GetMouse? 
DS> I need to do this for a project using a track-ball.

You have to use low memory globals.  See TN 206 and in particurlar the MacDTS
Sample Code #17 referenced therein. 
 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker
Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org