RAD Studio Athens

1.296

Description

This code example is a VCL Forms application that uses the OnGesture event. The main form contains two objects: a panel and a gesture manager (see figure Main form).

Main form

Main form

The gesture manager is associated with the panel (see figure Panel1β€”Object Inspector).

Object Inspector

Panel1β€”Object Inspector

Only one standard gesture is enabled (sgiLeft). However, the OnGesture event is triggered every time a gesture is performed on the panel.

Code

The panel OnGesture callback is defined as follows:

uses Gestures;

{ ... }

procedure TMainForm.Panel1Gesture(Sender: TObject;
  const EventInfo: TGestureEventInfo; var Handled: Boolean);
var
  S: String;
begin
  if GestureToIdent(EventInfo.GestureID, S) then
    ShowMessage(S)
  else
    ShowMessage('Could not translate gesture identifier');
end;

Every time a gesture is performed on the panel, a message box appears with the string representation of the gesture identifier.

Uses