码迷,mamicode.com
首页 > Windows程序 > 详细

DELPHI FMX 同时使用LONGTAP和TAP

时间:2017-04-13 21:17:50      阅读:357      评论:0      收藏:0      [点我收藏+]

标签:point   bool   需要   测试   eid   ges   gil   tin   单击   

在应用到管理图标时,如长按显示删除标志,单击取消删除标志。
在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);
begin?
     if Point<>tapLocation then begin?
          tapLocation.X:=0;?
          tapLocation.Y:=0;?
         {执行Tap}
    end;?
end;?? 

 

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

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

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

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

DELPHI FMX 同时使用LONGTAP和TAP

标签:point   bool   需要   测试   eid   ges   gil   tin   单击   

原文地址:http://www.cnblogs.com/onexyz/p/6705765.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!