[futurebasic] Re: handling mouse events

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1998 : Group Archive : Group : All Groups

From: David Blache <microcsm@...>
Date: Thu, 22 Jan 98 17:41:44 -0600
In a message dated 1/22/98 5:23 PM, Jeffrey Schwartz wrote:

>Some more reading (it was actually right in front of my eyes) showed that
>the expected behavior of:
>
>SELECT mousevent
>case _click1 : FN HandleSingleClick
>case _click2 : FN HandleDoubleClick
>case _click3 : FN HandleTripleClick
>END SELECT
>
>is, in fact,  that _click1 is reported first, then _click2, then _click3. 
>So a triple click will call handlesingleclick, handledoubleclick AND
>handletripleclick.  My question then becomes is there a way to call
>HandleDoubleClick without calling HandleSingleClick?
>
>{My motivation for this is that I'm writing an application to be usuable
>with a remote mouse.  The more functionality I can build into the remote
>mouse, i.e. the more functions the mouse can do, the better.}

Since you want to test for triple-clicks (and possibly more), your best bet is to do it like it is done in low-level languages.

Store the time (TickCount) and position (GetMouse) of the click in globals _each time a mousedown is detected_.

That done, whenever the mouse is clicked, you can determine if it is a double-click by testing to see if the following conditions are met:

1) current TickCount <= (globalTicks + [DblTime])
2) current mousepos is within 5 pixels of globalpos in each direction

If both of those tests pass, the click is a double-click.

To test for a triple-click would require an additional set of globals, using the same tests.

========================================
|       David Blache - Developer       |
========================================
|   Staz Software, Inc - Stazologist   |
|        (tech@...)       |
|   Microcosm Software, Inc. - Owner   |
|        (microcsm@...)        |
========================================