Board index » delphi » How to make the mouse's DOUBLE CLICK detection possible?

How to make the mouse's DOUBLE CLICK detection possible?

Hi, I really need help here. I don't know how to write my program so that it
can detect my mouse's double click. I tried and tried and tried and i still
cannot get it right.....

After i clicked the choice (not double click) it directly calls the
procedure i wanted to do, and what i expected is it can only be called if
there is double click detected..... i really out of ideas on how to make it
possible :( can anyone help me here?

my e-mail:

hk...@pc.jaring.my

 

Re:How to make the mouse's DOUBLE CLICK detection possible?


I have tried to get the normal double clicking detection to work, but I
never could.  The workaround I came up with was to start a timer and check
for double clicks.  The following code should get you on the right track.

DblClkTime: boolean;
OldClk: TPoint;

procedure TTopWindow.WMLButtonDown(var Msg: TMessage);
var P: TPoint;
    TheDC: HDC;
begin
  GetCursorPos(P);
  ScreenToClient(HWindow,P);
  if DblClkTime then
  begin
    if ((P.X < OldClk.X + GetSystemMetrics(sm_CXDoubleclk)) and
        (P.X > OldClk.X - GetSystemMetrics(sm_CxDoubleClk)) and
        (P.Y < OldClk.Y + GetSystemMetrics(sm_CYDoubleClk)) and
        (P.Y > OldClk.Y - GetSystemMetrics(sm_CYDoubleClk))) then
            WMLButtonDblClick;
    else
      DblClkTime := false;
  end
  else
  begin
    Settimer(HWindow,1,GetDoubleClickTime,nil);
    DblClkTime := true;
    OldClk := P;
  end;
end;

procedure TTopWindow.WMTimer(var Message: TMessage);

begin
  KillTimer(HWindow,1);
  DblClkTime := false
end;

    Rick

Simon Kho Hui Kian wrote in message <75554s$cr...@news5.jaring.my>...

Quote
>Hi, I really need help here. I don't know how to write my program so that
it
>can detect my mouse's double click. I tried and tried and tried and i still
>cannot get it right.....

>After i clicked the choice (not double click) it directly calls the
>procedure i wanted to do, and what i expected is it can only be called if
>there is double click detected..... i really out of ideas on how to make it
>possible :( can anyone help me here?

>my e-mail:

>hk...@pc.jaring.my

Other Threads