OnGesture (Delphi)
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).
Error creating thumbnail: Unable to save thumbnail to destination
Main form
The gesture manager is associated with the panel (see figure Panel1—Object Inspector).
Error creating thumbnail: Unable to save thumbnail to destination
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
- 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 )