I found a useful fix for an annoying Firemonkey problem today that I thought would be useful to share.

I found a useful fix for an annoying Firemonkey problem today that I thought would be useful to share.

I've just implemented a custom long-tap gesture in my app. The component is a TPaintbox sitting on a TTabControl page and I couldn't use the GestureManager as it's long tap gesture behaves oddly on Android.

My solution worked perfectly on Android and Windows but on iOS I kept getting sporadic MouseUp events while still touching which caused the long tap detection to fail. It was caused by a rogue CancelTouches event firing from somewhere.

Thanks to an old question on the EMB forums, it led me to the solution.

The tab control has its own gesture management built in, including LongTap. For some reason this interferes with LongTap of any child controls. By unticking the LongTap gesture from the Touches property of the tabitem, it fixed the problem and now works perfectly on iOS!

A fun 20 minutes but well worth it! I hope this helps anyone else with similar problems.

Comments

Post a Comment