Use A Cross Platform Long Tap Event In Delphi XE7 Firemonkey On Android, IOS, OSX, And Windows

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.