delphi4arab منتديات دلفي للعرب

نسخة كاملة : اضافة خاصية dblclick الىtbutton
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم
كيف اضيف خاصية dblclick 
الى button1
وعليكم السلام ورحمة الله

لا اعرف ان كان هناك شئ بدوال API او غيره يمكن تطبيق ذلك

ولكن دعني اعطيك فكرة

التايمر اجعل خاصية Interval=500 نصف ثانية فقط


كود :
unit Unit1; interface uses  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Buttons, Vcl.StdCtrls, Vcl.ExtCtrls; type  TForm1 = class(TForm)    btn1: TButton;    tmr1: TTimer;    procedure btn1Click(Sender: TObject);    procedure tmr1Timer(Sender: TObject);  private    { Private declarations }  public    { Public declarations }  end; var  Form1: TForm1;  int:Integer; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin  int:=int+1;  tmr1.Enabled:=True;  Self.Text:=Int.ToString() ; end; procedure TForm1.tmr1Timer(Sender: TObject); begin if int=1 then begin int:=0; tmr1.Enabled:=False;  Self.Text:=Int.ToString() ; end; if int=2 then begin int:=0; tmr1.Enabled:=False; Self.Text:=Int.ToString() ; ShowMessage('Double Click'); end; end; end.

خلال نصف ثانية اذا لم ينقر المستخدم على الزر مرة ثانية يعتبر نقرة واحدة
والا تم اظهار الرسالة
هكدا
PHP كود :
unit Unit1;

interface

uses
  Windows
, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 
 Dialogs, StdCtrls;

type
  TButton 
= class(StdCtrls.TButton)
 
 private
    procedure WMLButtonDblClk
(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
 
 end;

type
  TForm1 
= class(TForm)
 
   Button1: TButton;
 
   Button2: TButton;
 
 private
    
{ Private declarations }
 
 public
    
{ Public declarations }
 
 end;

var
 
 Form1: TForm1;

implementation

{$R *.dfm}

{ 
TButton }

procedure TButton.WMLButtonDblClk(var Message: TWMLButtonDblClk);
begin
  ShowMessage
('Db Test');
end;

end. 

انتبه الحدث سستأثر به كل الأصناف الشبيهة