1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Long Touch event generation method for Delphi XE5~XE7

Discussion in 'Delphi Android And IOS' started by AdminDF, Oct 15, 2014.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    OnMouseClick event is used for Short Touch event in Button or ListBox, etc.
    Delphi in FireMonkey do not provide a Long touch event separately.
    Android or iOS smart device determines a long Touch time about 0.7 to 1.0 seconds normally .
    Thus, Long Touch can be determined by measuring the count timer 0.1 seconds while pressing the button or any other objects.

    [Method]
    1. OnMouseDown : Timer Start
    2. OnMouseUp : Count Timer ~ Short Touch Event
    3. OnTimer : Increase Timer Count ~ Long Touch Event

    [Example source code]
    1. Timer Initialize
    Enable : False
    Interval : 100 (msec)

    2. Global variable declaration

    Code:
    var
      ClickInterval : Cardinal = 0;
    const
       LONG_TIME = 8;  // Long Touch Time : 0.8 sec
    

    3. Event Handlers work

    Code:
    procedure TForm1.ListBoxItem1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    begin
       ClickInterval := 0;
       Timer1.Enabled := TRUE;
    end;
    
    //**********************************************************************************
    // Short Touch
    procedure TForm1.ListBoxItem1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
    begin
       if ClickInterval < LONG_TIME then
       begin
          Timer1.Enabled := FALSE;
          ClickInterval := 0;
          ShowMessage( 'ListBox Shot Touch..!!');
        end;
    end;
    
    //***************************************************************************************
    // Long Touch
    // Called once every 0.1 seconds ->  When the 8th call is a Long touch
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
       ClickInterval := ClickInterval + 1;
    
       if ( ClickInterval = LONG_TIME ) then
       begin
          Timer1.Enabled := FALSE;
          ShowMessage( 'ListBox Long Touch..!!');
       end;
    end;
    
    Download HERE
     
  2. chrpaz
    Online

    chrpaz Guest

    thanks
     
  3. zhuye999
    Offline

    zhuye999 DF Junior

    [font='Open Sans', Arial, Tahoma, Verdana, sans-serif]thanks[/font]
     
  4. mndoza
    Offline

    mndozamndoza is a Featured Member DF Junior DF Donator

    Thanks


    iPad 'den Tapatalk aracılığı ile gönderildi
     

Share This Page