delphi4arab منتديات دلفي للعرب
اضافة خاصية dblclick الىtbutton - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : اضافة خاصية dblclick الىtbutton (/showthread.php?tid=8595)



اضافة خاصية dblclick الىtbutton - jeanjamil - 07-04-2017

السلام عليكم
كيف اضيف خاصية dblclick 
الى button1


RE: اضافة خاصية dblclick الىtbutton - Delphi4Us - 07-04-2017

وعليكم السلام ورحمة الله

لا اعرف ان كان هناك شئ بدوال 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.

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


RE: اضافة خاصية dblclick الىtbutton - Agmcz - 07-04-2017

هكدا
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. 

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