DelphiFAQ Home Search:
General :: Programming :: Delphi :: VCL
About the Delphi VCL (Visual Component Library)

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

How to add DblClick event?

If it has TControl as an ancestor then put:

published property OnDblClick;

into your class declaration.

Otherwise use the following code to capture the message:

type
   TYourClass=class(WhatEverclass you want)
   private
     FOnDblClick : TNotifyEvent;
   procedure WMDblClick(var :TWMLButtonDBLCLK);
     message WM_LBUTTONDBLCLK;
   // ..
   public
     OnDblClick : TNotifyEvent read FOnDblClick write FOnDblClick;
   end;
 
 // if you don't want a property OnDblClick
 procedure TYourClass.WMDblClick(var :TWMLButtonDBLCLK);
 begin
   inherited;
   // do your stuff here
 end;
 
 // or: if you do want a property OnDblClick
 procedure TYourClass.WMDblClick(var :TWMLButtonDBLCLK);
 begin
   inherited;
   if Assigned (FOnDblClick)
     FOnDblClick(Self);
 end;

Generated 12:01:22 on Feb 22, 2018