Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
CodeDatabaseDelphiRAD Studio

Learn How To Use Long Tap Gestures In Delphi With FMX.TapAndHold Sample

FMX.TapAndHold Sample uses TGestureManager.

Location

You can find the TapAndHold sample project at:

  • Start | Programs | Embarcadero RAD Studio Sydney | Samples and then navigate to:
  • – Object Pascal\Mobile Snippets\InteractiveGestures\TapAndHold
  • – CPP\Mobile Snippets\InteractiveGestures\TapAndHold
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

The TapAndHold sample demonstrates how to use long tap gestures on an iOS or Android device. The sample demonstrates how to detect and act with long tap gestures.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: TapAndHold.dproj.
    • C++: TapAndHold.cbproj.
  2. Select the target platform, iOS and Android supported.
  3. Press F9 or choose Run > Run.
  4. Press the screen with a finger. Hold pressed to see a message with the tap location and the date-time information.

Files

File in DelphiFile in C++Contains
TapAndHold.dprojTapAndHold.cbprojThe project itself.
TapHoldForm.fmxTapHoldForm.fmxThe main form where the components are located.
TapHoldForm.pasTapAndHoldPCH.hTapAndHold.cppUsed to define and implement the sample.
Information.txtInformation.txtFurther information about the sample.

Implementation

  • The sample uses TImage to display and define a 2D image component.
  • The TGestureManager class is used to manage all the touch and gesturing functionalities of the application.
  • The TGestureEventInfo describes a gesture event. It is a record that contains information about a gesture event. The TGestureEvent type passes a TGestureEventInfo record to the user code.

The sample shows a picture. When the user holds press a finger on the picture, the TGestureEventInfo detects a long tap gesture and the screen shows a message with the location and date-time information of the long tap. The sample uses the field Location of the TGestureEventInfo to show the screen tap location and the FormatDateTime to show the date-time value of the long tap.

The link below will redirect you to the original post of the sample:

http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FMX.TapAndHold_Sample


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES