[comp.sys.amiga.tech] PropGadgets and IDCMP

scott@applix.UUCP (Scott Evernden) (05/26/88)

The user slides the knob of PropGadget:
   I get a GADGETUP message when the mouse button is released.

The user clicks in the PropGadget's container (away from the knob):
   I get a GADGETUP message when the mouse button is depressed.
   I get a SELECTUP message when the button is released.

Is there a way to differentiate between the two GADGETUP situations?
Why do I get the SELECTUP?  (The SELECTUP is confusing my code.)  
I don't really want to have to deal with remembering a bunch of
GADGET/MOUSEBUTTON state, so how can I prevent it?

-scott

dpvc@ur-tut (Davide P. Cervone) (06/01/88)

In article <706@applix.UUCP> scott@applix.UUCP (Scott Evernden) writes:
>The user slides the knob of PropGadget:
>   I get a GADGETUP message when the mouse button is released.
>
>The user clicks in the PropGadget's container (away from the knob):
>   I get a GADGETUP message when the mouse button is depressed.
>   I get a SELECTUP message when the button is released.
>
>Is there a way to differentiate between the two GADGETUP situations?
>Why do I get the SELECTUP?  (The SELECTUP is confusing my code.)  
>I don't really want to have to deal with remembering a bunch of
>GADGET/MOUSEBUTTON state, so how can I prevent it?

Scott:

You can not count on getting SELECTDOWN and SELECTUP messages in pairs, or
in any particular order, for that matter.  There are LOTS of ways to get one
without the other.  For instance, if you click and hold down the button on
one of the window's depth gadgets and then move the pointer off the gadget
before you let go, you should get a SELECTUP with no SELECTDOWN (I'm doing this
from memory, but I think that shoud do it).  Or, if you are holding down the
mouse button when a new window opens (like a System Request or something), and 
your window becomes inactive while your holding down the button, you may NEVER
get the SELECTUP message.  Worse yet, after you take care of the system request
and click in your window again, you get a second SELECTDOWN.

These situations are not far fetched, so you should try to write your code
to handle them.  One technique that I've found helpful is to receive 
INACTIVEWINDOW events; when you receive one, all bets are off as to what the 
mouse is doing.  I cancel any drawing/dragging that may have been in progress
when the window became inactive.

Hope this helpls.

Davide P. Cervone
dpvc@tut.cc.rochester.edu
dpvc@ur-tut.UUCP
DPVC@UORDBV.BITNET