اضافة خاصية dblclick الىtbutton
#1
السلام عليكم
كيف اضيف خاصية dblclick 
الى button1
الرد
#2
وعليكم السلام ورحمة الله

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

خلال نصف ثانية اذا لم ينقر المستخدم على الزر مرة ثانية يعتبر نقرة واحدة
والا تم اظهار الرسالة
قل: اللهم فاطِرَ السماوات والأرض عالم الغيبِ والشهادة، ربَّ كُلِّ شَيءٍ ومَلِيكَه، أَشْهد أن لا إله إلا أنت، أعوذ بك من شرِّ نفسي وشرِّ الشيطان وشِرْكِهِ وأن أقترف على نفسي سوءًا أو أجرُّه إلى مسلم
[-] كل من 1 user says قال شكرا ل Delphi4Us على المشاركة المفيدة
  • jeanjamil
الرد
#3
هكدا
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. 

انتبه الحدث سستأثر به كل الأصناف الشبيهة
سبحان الله وبحمده سبحان الله العظيم
[-] كل من 1 user says قال شكرا ل Agmcz على المشاركة المفيدة
  • jeanjamil
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم