unit Unit2;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ExtCtrls,
Vcl.StdCtrls;
type
TForm2 =
class(TForm)
ListBox1: TListBox;
TripleClickTimer: TTimer;
Memo1: TMemo;
procedure ListBox1DblClick(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure TripleClickTimerTimer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
TripleClick : Boolean;
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure MM(s:
string);
begin Form2.Memo1.Lines.Add(s);
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Memo1.Lines.Add('
ListBox1Click: startet einen Timer');
Memo1.Lines.Add('
ListBox1DblClick: Auswertung');
end;
procedure TForm2.ListBox1Click(Sender: TObject);
begin
TripleClick := TripleClickTimer.Enabled;
end;
procedure TForm2.ListBox1DblClick(Sender: TObject);
begin
TripleClick := False;
TripleClickTimer.Interval := GetDoubleClickTime();
TripleClickTimer.Enabled := True;
while TripleClickTimer.Enabled
do
begin
Application.ProcessMessages;
end;
if TripleClick
then
MM ('
Triple click on item: ' + ListBox1.Items[ListBox1.ItemIndex])
Else
MM ('
Double click on item: ' + ListBox1.Items[ListBox1.ItemIndex]);
end;
procedure TForm2.TripleClickTimerTimer(Sender: TObject);
begin
TripleClickTimer.Enabled := False;
end;
end.