FMX.TapAndHold Sample

From Appmethod Code Examples
Jump to: navigation, search

This sample use the TGestureManager class to demonstrate how to use long tap gestures.

Location

You can find the TapAndHold sample project at:

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:
    • Object Pascal: 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 Object Pascal 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.

Uses

See Also

Samples

Personal tools