本文整理自网络,侵删。
在应用到管理图标时,如长按显示删除标志,单击取消删除标志。在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 application.title在win7下失效了?
Delphi combobox的属性和事件、及几个鼠标事件的触发
更多相关阅读请进入《Delphi》频道 >>