[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

If the GACT_FOLLOWMOUSE flag is set for a gadget, the application will
receive mouse movement broadcasts as long as the gadget is active. This
section covers the behavior of proportional, boolean and string gadgets,
although there are major caveats in some cases:

  * Unlike IDCMP_GADGETUP and IDCMP_GADGETDOWN IntuiMessages, the
    IAddress field of an IDCMP_MOUSEMOVE IntuiMessage does not point to
    the gadget.  The application must track the active gadget (this
    information is readily obtained from the IDCMP_GADGETDOWN message)
    instead of using the IAddress field.


	Right                          Wrong
        -----                          -----
        imsg=GetMsg(win->UserPort);    imsg=GetMsg(win->UserPort);
        class=imsg->Class;             class=imsg->Class;
        code=imsg->Code;               code=imsg->Code;
        /* OK */                       /* ILLEGAL ! */
        iaddress=imsg->IAddress;       gadid=((struct Gadget *)
                                               imsg->IAddress)->GadgetID;
        ReplyMsg(imsg);                ReplyMsg(imsg);


    Using the code in the left column, it is acceptable to get the
    address of a gadget with gadid=((struct Gadget *)iaddress)->GadgetID
    but only after you have checked to make sure the message is an
    IDCMP_GADGETUP or IDCMP_GADGETDOWN.

  * Boolean gadgets only receive mouse messages if both GACT_RELVERIFY
    and GACT_FOLLOWMOUSE are set.  Those cases described below with
    GACT_RELVERIFY cleared do not apply to boolean gadgets.

  * In general, IDCMP_MOUSEMOVE messages are sent when the mouse changes
    position while the gadget is active.  Boolean and proportional
    gadgets are active while the mouse button is held down, thus mouse
    move messages will be received when the user "drags" with the mouse.
    String gadgets are active until terminated by keyboard entry or
    another object becomes active (generally by user clicking the other
    object).  GACT_FOLLOWMOUSE string gadgets will generate mouse moves
    the entire time they are active, not just when the mouse button is
    held.

The broadcasts received differ according to the gadget's flag settings.
If using the GACT_IMMEDIATE and GACT_RELVERIFY activation flags, the
program gets a gadget down message, receives mouse reports
(IDCMP_MOUSEMOVE) as the mouse moves, and receives a gadget up message
when the mouse button is released.  For boolean gadgets, the mouse button
must be released while the pointer is over the gadget. If the button is
not released over the boolean gadget, an IDCMP_MOUSEBUTTONS message with
the SELECTUP qualifier will be sent.

If only using the GACT_IMMEDIATE activation flag, the program gets a
gadget down message and receives mouse reports as the mouse moves. The
mouse reports will stop when the user releases the mouse select button.
This case does not apply to boolean gadgets as GACT_RELVERIFY must be set
for boolean gadgets to receive mouse messages. If only using the
GACT_RELVERIFY activation flag, the program gets mouse reports followed by
an up event for a gadget.  For boolean gadgets, the IDCMP_GADGETUP event
will only be received if the button was released while the pointer was
over the gadget.  If the button is not released over the boolean gadget, a
IDCMP_MOUSEBUTTONS message with the SELECTUP qualifier will be received if
the program is receiving these events.

If neither the GACT_IMMEDIATE nor the GACT_RELVERIFY activation flags are
set, the program will only receive mouse reports.  This case does not
apply to boolean gadgets  as GACT_RELVERIFY must be set for boolean
gadgets to receive mouse messages.


[Back to Amiga Developer Docs]