[comp.sys.amiga.programmer] Placing Pointer Programatically?

tmb@davinci.acc.Virginia.EDU (Thomas M. Breeden) (01/24/91)

What is the best way for a program to move the pointer to a
specific location?

Looking over the libs manual, I found I can do this by opening
and writing a mouse move to the inputdevice.

Is this the way? The program's window can ask for active and deactivate window
Intuition messages to attempt to make sure that it doesn't move the
pointer on some other process, but that will still run the risk of
leaking.

Tom Breeden
tmb@virginia.EDU  -->> Internet
tmb@virginia      -->> BITNET


            - Tom Breeden
              tmb@virginia.EDU      -> Internet
              tmb@virginia          -> BITNET

GUTEST8@cc1.kuleuven.ac.be (Ives Aerts) (01/25/91)

The way I do this is the following:
  open the input.device
  make an InputEvent structure of class IECLASS_POINTERPOS
     and ie_X,ie_Y the absolute mouse coordinates.
  use the IND_WRITEEVENT command of the input.device

Dunnow if there's anything illegal about this (hope not)
You can allso do relative moves if you use the RELATIVEMOUSE
qualifier in ie_Qualifier.
------------------------------------------------------------------------
      Ives Aerts          |           IBM definition SY-34378
GUTEST8@BLEKUL11.BITNET   |    A signature consists of sequences of
GHGAEAB@BLEKUL11.BITNET   |  non-blank characters separated by blanks.
------------------------------------------------------------------------

peter@cbmvax.commodore.com (Peter Cherna) (01/26/91)

In article <1991Jan24.132154.13609@murdoch.acc.Virginia.EDU> tmb@davinci.acc.Virginia.EDU (Thomas M. Breeden) writes:
>What is the best way for a program to move the pointer to a
>specific location?
>
>Looking over the libs manual, I found I can do this by opening
>and writing a mouse move to the inputdevice.
>
>Is this the way? The program's window can ask for active and deactivate window
>Intuition messages to attempt to make sure that it doesn't move the
>pointer on some other process, but that will still run the risk of
>leaking.

The correct way to move the pointer is indeed to write a IECLASS_POINTERPOS
event to the input.device.

However, remember that the pointer is an extension of the user's hand.
Constraining the pointer is hardly better than tying his hand.  Even
without knowing your application, I'd bet there's a 90% chance that
you'd be better off letting the pointer move freely.  Pointer constraints
are normally unnatural and confuse users.

>Tom Breeden

     Peter
--
     Peter Cherna, Software Engineer, Commodore-Amiga, Inc.
     {uunet|rutgers}!cbmvax!peter    peter@cbmvax.commodore.com
My opinions do not necessarily represent the opinions of my employer.
"Oh, PIN-compatible!  I thought you wanted me to make it IN-compatible!"