zoukankan      html  css  js  c++  java
  • 【转】DELPHI FMX 同时使用LONGTAP和TAP

    在应用到管理图标时,如长按显示删除标志,单击取消删除标志。
    在FMX的手势管理中,只有长按LONGTAP,点击TAP则是单独的事件,不能在同事件中管理。
    在执行LONGTAP后,TAP也会被触发​,解决方案,判断长按和点击是否同位置:
    添加变量

    TapLoaction:TPointf​​;
    
    procedure Tform1.form1Gesture(Sender: TObject;  const EventInfo: TGestureEventInfo; var Handled: Boolean);​
    begin
        case  EventInfo.GestureID of
              igilongtap: begin​
                      tapLocation:=  EventInfo.Location;​
                     {执行LONGTAP}
               end;​
         end;​
    end;​​​
    
    procedure Tform1.form1Tap(Sender: TObject; const Point: TPointF);
    beginif Point<>tapLocation then begin​
              tapLocation.X:=0;​
              tapLocation.Y:=0;​
             {执行Tap}
        end;​
    end;​​ 

    经过测试发现,要更理想的效果,

    还需要加一个TIMER设置时间隔,

    在ONTAP事件里判断,是否超过时间间隔才响应。

    原文地址

    避免长按后一放手就响应了。

  • 相关阅读:
    TensorFlow学习笔记--CIFAR-10 图像识别
    第二章--第二节:注释
    webbrowser
    RichViewEdit
    RichEdit
    TreeView
    RichView
    ListView
    DesktopLoader服务程序
    Delphi实现程序只运行一次并激活已打开的程序
  • 原文地址:https://www.cnblogs.com/kinglandsoft/p/12685968.html
Copyright © 2011-2022 走看看