Show: Delphi C++
Display Preferences

Gesture Support in Metropolis UI Applications

From RAD Studio
Jump to: navigation, search

Go Up to Developing Metropolis UI Applications


Metropolis UI applications support the following gestures:

Custom gestures are not supported in Metropolis UI applications.

Gesture support in FireMonkey is provided through two different Windows APIs:

  • RealTimeStylus API for standard (single-touch) gestures
  • Windows Touch API for interactive (multi-touch) gestures

Support for Windows 8 Interactive Gestures

When you run a Metropolis UI application on Windows 8, most of the Windows 8 interactive gestures are supported, as follows:

Windows 8 Gesture Support in Metropolis UI Applications

Tap

Supported as a click, translated by Windows 8

Press and Hold

Not supported

Slide

Not supported *

Swipe

Not supported *

Turn

Supported as Rotate

Pinch

Supported as Zoom (the EventInfo.Distance value decreases)

Stretch

Supported as Zoom (the EventInfo.Distance value increases)

* The Slide and Swipe gestures can be simulated using the Pan gesture in Metropolis UI applications, by tracking the location and direction of the pan movement.

The supported interactive gestures are described in:

For more information about equivalent interactive gestures, see http://msdn.microsoft.com/en-us/library/windows/apps/hh761498.aspx#input_modes.

Handling Gestures with Windows 8

In Windows 8, when the RealTimeStylus is enabled for a window, all gestures are sent through the MS Windows 8 RealTimeStylus API, and the Windows Touch API does not report any events.

To workaround this issue, a global flag has been added to FireMonkey that allows the RealTimeStylus API to be disabled. When the RealTimeStylus API is disabled, FireMonkey does not detect standard gestures. Instead, the gesture events from the Windows Touch API are reported individually through the OnGesture event handler.

You can interpret these events to determine the gesture that was made by the user. A Windows Touch gesture is reported as multiple events, beginning with one event with the TGestureEventInfo.Flag containing gfBegin, and ending with an event containing gfEnd. For more information, see FMX.Types.TInteractiveGestureFlag.

To enable the reporting of Windows Touch events, and to enable interactive gestures, the following code should be added to the beginning of the main program file:

Delphi:

TPlatformServices.Current.GlobalFlags.Add(GlobalDisableStylusGestures, True);

C++:

TPlatformServices::Current->GlobalFlags->Add(GlobalDisableStylusGestures, true);

You should also add FMX.Platform and FMX.Consts to your uses section or #include statements.

This workaround is not required on Windows 7 and might not be required in the final release of Windows 8.

See Also

Personal tools
In other languages
Previous Versions
Assistance