OnGesture (C++)
Contents
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
The gesture manager is associated with the panel (see figure Panel1—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:
void __fastcall TMainForm::Panel1Gesture(TObject *Sender,
const TGestureEventInfo &EventInfo, bool &Handled) {
String s;
if (GestureToIdent(EventInfo.GestureID, s)) {
ShowMessage(s);
}
else {
ShowMessage("Could not translate gesture identifier");
}
}
Every time a gesture is performed on the panel, a message box appears with the string representation of the gesture identifier.
Uses
- Vcl.Controls.TControl.OnGesture ( fr | de | ja )
- Vcl.ExtCtrls.TPanel.OnGesture ( fr | de | ja )
- Vcl.Controls.TGestureEventInfo ( fr | de | ja )
- Vcl.Touch.Gestures.GestureToIdent ( fr | de | ja )