FMX.InteractiveGestures Sample

From Appmethod Code Examples
Jump to: navigation, search

This sample demonstrates how to use interactive gestures in FireMonkey.

Location

You can find the InteractiveGestures sample project at:

Description

The application creates a form that allows loading an image that supports interactive gestures such as Pan, Zoom, Rotate, and Press and Tap.

The main form contains a panel (as a placeholder for the image), an Add Picture option in the menu, and a TOpenDialog component.

How to Use the Sample

  1. Navigate to the location given above.
  2. Open InteractiveGestures.dproj.
  3. Press F9 or choose Run > Run.

Files

The project has one source file, Unit1.pas, which contains the class for the main form.

Classes

TForm36 is the class that implements the main form. It contains a menu bar with the Add Picture option, a TPanel used to load the image and a TOpenDialog component.

Implementation

  • The TPanel component implements the OnGesture event and calls the appropriate handler for the current gesture.
  • The handleZoom, handlePan, handlePressAndTap, and handleRotate methods implement the way the image changes according to the gesture being used.
  • The TPanel component must have the Zoom, Pan, Rotate, and PressAndtap options checked in the Touch.InteractiveGestures property in the Object Inspector.

Uses

See Also

Personal tools