Using Gesturing in Your Applications

From RAD Studio
Jump to: navigation, search

Go Up to How To Create an Application that Uses Gesturing Components


To Add Gesturing Features to Your Application

  1. In the Form Designer, add the component or components that will use the gesturing features.
    Large components like panels and panel groups work well with gesturing.
  2. For desktop platforms add a GestureManager to your project, optionally give it a specific name, and assign the gesture manager:
    Note: Mobile platforms are gesture-enabled by default.
    1. On the Tool Palette, find and double-click the GestureManager, located in the Gestures category:
      GMIcon2.png
      (either Vcl.Touch.GestureMgr.TGestureManager or FMX.Types.TCustomTouchManager.GestureManager).
      Gestures are not enabled for the control if the Assign a GestureManager message appears in the Gestures field
      This adds a GestureManager to your project, and gives it a default name such as GestureManager1.
    2. If you want to change the default name of the GestureManager, enter a name in the Name field for the GestureManager in the Object Inspector. The default name is typically GestureManager<n>.
    3. Assign a GestureManager for each component that you want to work with gestures:
      1. Select the GestureManager (either in the Form Designer or in the component dropdown in the Object Inspector).
        When Assign a Gesture Manager is displayed, click the ProjectOptionsDownArrow2.jpg in the GestureManager field to display the existing Gesture Managers
      2. In the entry field for the GestureManager property in the Object Inspector (located under the Touch node), click the down-arrow ProjectOptionsDownArrow2.jpg. This displays a list of available gesture managers in the GestureManager field.
      3. Select a gesture manager from the list of available gesture managers:
        GMList.png
    4. With the containing component selected in the Form Designer, open the Touch node on the Object Inspector. Verify that the GestureManager field displays the name you assigned to the GestureManager for this component.
  3. For both desktop and mobile platforms:
    1. In the control's Touch | Gestures field in the Object Inspector, select the specific gesture(s) you want to enable.
    2. Implement an OnGesture event handler (procedure) for each gesture that you are enabling for the control, and handle the appropriate EventInfo.GestureId.
      For an event handler example, see Implementing the OnGesture Event Handler in Gestures in FireMonkey.

See Also

Platform-Specific Information

Code Examples

Samples