Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Mouse Up eventinda click sayımı
#1
iyi günler arkadaşlar,

bir sorum olacaktı.

mouse up eventında 1 saniyede 3'ten fazla mouse click yapınca uyarı verecek bir fonksion nasıl yapabilirim, başım ağrıdı düşünmekten Smile

iyi günler
Cevapla
#2
İlk "Klick" geldiğinde 1 sn.' lik bir timer çalıştırmaya başla. timer aktifken başka "klick" gelirse kullanacağın bir sayacı arttırarak kontrolünü yapabilirsin.
Cevapla
#3
1 saniyede geçen tıklama sayısı değilde bir saniye içinde olan tıklama sayısı lazım bana.
Cevapla
#4
uses
 System.diagnostics, System.TimeSpan;

var
 clickCount: integer;
 sw: TStopwatch;

procedure TForm1.FormCreate(Sender: TObject);
begin
 clickCount := 0;
 sw := TStopwatch.Create;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Single);
var
 Second: double;
 Elapsed: TTimeSpan;

begin
 if Button = TMouseButton.mbLeft then
 begin
   inc(clickCount);
   if not sw.IsRunning then
     sw.Start;
        Elapsed := sw.Elapsed;
     Second := Elapsed.TotalMilliseconds;
   if clickCount > 3 then
   begin
     clickCount := 0;

     sw.Stop;
     sw.Reset;

     if Second < 1001 then // bir saniye ve aşağısında
       ShowMessage('Bir saniye veya altında üç defadan fazla  sol tıkladınız');

   end
   else
   begin
     if Second > 1000 then
     begin // timere gerek kalmadan hep bir saniye aralığını dikkate alır böylece
       clickCount := 1;//ilk defa basılmış kabul ediyoruz
       sw.Stop;
       sw.Reset;
     end;

   end;
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla
#5
(26-03-2021, Saat: 15:11)savasabd Adlı Kullanıcıdan Alıntı:
uses
 System.diagnostics, System.TimeSpan;

var
 clickCount: integer;
 sw: TStopwatch;

procedure TForm1.FormCreate(Sender: TObject);
begin
 clickCount := 0;
 sw := TStopwatch.Create;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Single);
var
 Second: double;
 Elapsed: TTimeSpan;

begin
 if Button = TMouseButton.mbLeft then
 begin
   inc(clickCount);
   if not sw.IsRunning then
     sw.Start;
        Elapsed := sw.Elapsed;
     Second := Elapsed.TotalMilliseconds;
   if clickCount > 3 then
   begin
     clickCount := 0;

     sw.Stop;
     sw.Reset;

     if Second < 1001 then // bir saniye ve aşağısında
       ShowMessage('Bir saniye veya altında üç defadan fazla  sol tıkladınız');

   end
   else
   begin
     if Second > 1000 then
     begin // timere gerek kalmadan hep bir saniye aralığını dikkate alır böylece
       clickCount := 1;//ilk defa basılmış kabul ediyoruz
       sw.Stop;
       sw.Reset;
     end;

   end;

eline emeğine sağlık
Cevapla
#6
(26-03-2021, Saat: 15:47)kofmaster Adlı Kullanıcıdan Alıntı:
(26-03-2021, Saat: 15:11)savasabd Adlı Kullanıcıdan Alıntı:
uses
 System.diagnostics, System.TimeSpan;

var
 clickCount: integer;
 sw: TStopwatch;

procedure TForm1.FormCreate(Sender: TObject);
begin
 clickCount := 0;
 sw := TStopwatch.Create;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Single);
var
 Second: double;
 Elapsed: TTimeSpan;

begin
 if Button = TMouseButton.mbLeft then
 begin
   inc(clickCount);
   if not sw.IsRunning then
     sw.Start;
        Elapsed := sw.Elapsed;
     Second := Elapsed.TotalMilliseconds;
   if clickCount > 3 then
   begin
     clickCount := 0;

     sw.Stop;
     sw.Reset;

     if Second < 1001 then // bir saniye ve aşağısında
       ShowMessage('Bir saniye veya altında üç defadan fazla  sol tıkladınız');

   end
   else
   begin
     if Second > 1000 then
     begin // timere gerek kalmadan hep bir saniye aralığını dikkate alır böylece
       clickCount := 1;//ilk defa basılmış kabul ediyoruz
       sw.Stop;
       sw.Reset;
     end;

   end;

eline emeğine sağlık

Rica ederim, sağ olun, işinize yaramıştır umarım.
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla
#7
peki hocam bişey daha sorayım. peki şimdi saniyede 3 kere tıklayınca mesaj gösterip sıfırlattırıp tekrar saydırıyoz. şöyle bişi yapılabilirmi, 1 saniyede 3 kere tıkladıktan sonra mesja çıkınca 1 saniye boyunca tıklamayı yok say. timer olmadan gene bu şekil stopwatch ile yapılabilirmi?
Cevapla
#8
(07-04-2021, Saat: 22:49)kofmaster Adlı Kullanıcıdan Alıntı: peki hocam bişey daha sorayım. peki şimdi saniyede 3 kere tıklayınca mesaj gösterip sıfırlattırıp tekrar saydırıyoz. şöyle bişi yapılabilirmi, 1 saniyede 3 kere tıkladıktan sonra mesja çıkınca 1 saniye boyunca tıklamayı yok say. timer olmadan gene bu şekil stopwatch ile yapılabilirmi?

uses
  System.diagnostics, System.TimeSpan;

var
 clickCount: integer;
 sw: TStopwatch;
 yoksay: boolean;

procedure TForm1.FormCreate(Sender: TObject);
begin
 clickCount := 0;
 sw := TStopwatch.Create;
 yoksay := false;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Single);
var
 Second: double;
 Elapsed: TTimeSpan;

begin
 if Button = TMouseButton.mbLeft then
 begin
   inc(clickCount);
   if not sw.IsRunning then
     sw.Start;
   Elapsed := sw.Elapsed;
   Second := Elapsed.TotalMilliseconds;

   if (yoksay) and (Second < 1001) then
   begin
     clickCount := 0;
     ShowMessage('Seni yok sayıyorum.');
     exit;
   end
   else
     yoksay := false;

   if clickCount > 3 then
   begin
     clickCount := 0;

     sw.Stop;
     sw.Reset;

     if Second < 1001 then
     begin // bir saniye ve aşağısında
       ShowMessage('Bir saniye veya altında üç defadan fazla  sol tıkladınız');
       yoksay := true;
       sw.Start;

     end;

   end
   else
   begin
     if Second > 1000 then
     begin // timere gerek kalmadan hep bir saniye aralığını dikkate alır böylece
       clickCount := 1; // ilk defa basılmış kabul ediyoruz
       sw.Stop;
       sw.Reset;
     end;

   end;
 end;
end;
Herhangi bir basit problem, hakkında yeterince toplantı yapılarak, çözümsüz hale getirilebilir.
https://play.google.com/store/apps/developer?id=ONGUN
WWW
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Mouse Orta tuşu ile Dbgrid Scroll unu hareket ettirme stevenskat 2 366 22-08-2023, Saat: 22:37
Son Yorum: stevenskat
  Mouse Tıklatma apachi2006 7 2.057 08-02-2022, Saat: 11:57
Son Yorum: apachi2006
  windows 10 üzerinde klavye mouse ve dokunmatiği devre dışı bırakmak suleymangul0 1 1.085 09-03-2021, Saat: 20:05
Son Yorum: Tuğrul HELVACI
  BitBtn Click kontrol OZCANK 7 2.789 23-11-2020, Saat: 10:32
Son Yorum: mrmarman
  Formun tamamında geçerli mouse sağ click olayı yakalama cinarbil 4 1.654 07-11-2020, Saat: 20:34
Son Yorum: Mr.Developer



Konuyu Okuyanlar: 1 Ziyaretçi