Silverfrost Forums

Welcome to our forums

Detecting a double click in a %gr region

20 Dec 2007 9:22 #2530

I'm experimenting with a call-back function for a %gr region. Here is the first effort:

   INTEGER FUNCTION GR_FN()
   CHARACTER*(30) CBR
   INCLUDE <WINDOWS.INS>
   write (*,*) ' In GR_FN'
   CBR = CLEARWIN_STRING@('CALLBACK_REASON')
   write (*,*) CBR
   IX = CLEARWIN_INFO@('GRAPHICS_MOUSE_X')
   IY = CLEARWIN_INFO@('GRAPHICS_MOUSE_Y')
   write(*,*) IX, IY   
   GR_FN = 1
   END

I get a MOUSE_LEFT_CLICK both before and after a MOUSE_DOUBLE_CLICK - exactly as stated by the documentation. When I see the initial MOUSE_LEFT_CLICK, how do I determine if that was the user's intention, or is there a MOUSE_DOUBLE_CLICK in the offing? Is there anyone who can help with a snippet of code or an explanation of how they deal with this please?

Eddie

21 Dec 2007 11:11 #2534

ClearWin+ is simply relaying to you the mouse events that it receives.

A double click action is transmitted as the first click, then, if the time interval is suitably small, the second click is translated into a double click event.

The design of the user interface should allow for a user's poor attempt at a double click or a faulty mouse button. So a single click event must be either compatible or benign. For example, in an editor, a single click could set a selection whilst a double click extends the selection. In this case the initial single click is applied but is redundant when followed by a second click in rapid succession.

In other words it is not a good idea to make a single click mean something quite different from a double click. The single click event should be implemented anyway and then followed by the double click event.

If you still want to isolate the single click event then you will need to program a timer into your code and set your own tollerance between the two received events. But even then you will have a tricky programming task because you will have to implement an isolated single click retrospectively.

22 Dec 2007 1:34 #2542

Paul,

It is useful being told that something is difficult, because nothing is more frustrating than programming and debugging something for weeks, only to find out that there is a routine already in existence called something like 'get_filtered_mouse_click_and decypher_it@(result)'!

Deciding what a user would find most logical and convenient to do in a specific situation isn't always easy. I think that I'll avoid double-clicks in the short term.

Eddie

Please login to reply.