Developer SangHyun Oh has a blog post up where he demonstrates how to implement your own long tap event in Delphi XE7 Firemonkey. Basically the solution is to use a timer to count the time between the mouse down event and the mouse up event. If it is longer than 0.8 seconds then it counts as a long tap. The reason why I think this is great is because it works across all platforms that Firemonkey supports which are Windows, IOS, OSX, and Android. Firemonkey does actually have a long tap event but it is more complex to implement as it requires the use of the TGestureManager and the OnGesture event. I’ve used some other cross platform frameworks that don’t differentiate between mouse events and tap events. A long mouse click and a long mouse tap are handled the same with the same event. Using the timer like SangHyun demonstrates allows you to do this. It also allows you to debug, test, and use your long tap events on Windows and OSX normally. You can use this with Appmethod as well.
I needed this longTouch eventhandler in a project I am currently working on. I found this article very useful, but used it only as an inspiration. Instead of using a TTimer I simply used the TStopWatch record from System.Diagnostics
OnMouseDown (sender : TObject);
begin
fStopWatch.StartNew;
end;
OnMouseUp(sender : TObject);
begin
fStopWatch.Stop;
If fStopWatch.elapsedMilliseconds > 800 then
handleLongTap
else
handleShortTap;
end;