Forum > Packages and Libraries

SpeedButton dblclick

(1/2) > >>

eldonfsr:
HI i trying to implement event double click on speedbutton but i don't get trigger always  first click how i can do doubleclick trigger..
some sad timer but i can implement that please help me..
 

CM630:
Try this:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Buttons, LCLIntf ; type   { TForm1 }   TForm1 = class(TForm)    SpeedButton1: TSpeedButton;    procedure SpeedButton1Click(Sender: TObject);  private   public   end; var  Form1: TForm1;  FirstClick : QWord = 0;  Latency : QWord = 1000;  implementation {$R *.lfm} { TForm1 } procedure TForm1.SpeedButton1Click(Sender: TObject);begin  if ((GetTickCount64 - FirstClick) < GetDoubleClickTime) then  begin    ShowMessage ('double click');  end  else    FirstClick:= GetTickCount64;end;  end.  

Aruna:

--- Quote from: eldonfsr on December 19, 2025, 08:51:58 pm ---HI i trying to implement event double click on speedbutton but i don't get trigger always  first click how i can do doubleclick trigger..
some sad timer but i can implement that please help me..

--- End quote ---

Use  OnMouseDown + ssDouble. [ LCL reports double-clicks via the mouse shift state, not via OnClick. ]

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.SpeedButton1MouseDown(  Sender: TObject;  Button: TMouseButton;  Shift: TShiftState;  X, Y: Integer);begin  if ssDouble in Shift then  begin    ShowMessage('Double click detected');  end;end;
This works reliably, no timer needed.

eldonfsr:
Ok Thanks, great help

Thaddy:
Implementing doubleclick on TSpeedbutton? It is by design it isn't there.... Hence the name: TSpeedButton...

Navigation

[0] Message Index

[#] Next page

Go to full version