FMX.TapAndHold Sample uses TGestureManager.
Table of Contents
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
- Navigate to one of the locations given above and open:
- Delphi: TapAndHold.dproj.
- C++: TapAndHold.cbproj.
- Select the target platform, iOS and Android supported.
- Press F9 or choose Run > Run.
- Press the screen with a finger. Hold pressed to see a message with the tap location and the date-time information.
Files
File in Delphi | File in C++ | Contains |
---|---|---|
TapAndHold.dproj | TapAndHold.cbproj | The project itself. |
TapHoldForm.fmx | TapHoldForm.fmx | The main form where the components are located. |
TapHoldForm.pas | TapAndHoldPCH.h, TapAndHold.cpp | Used to define and implement the sample. |
Information.txt | Information.txt | Further 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
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition