LPARAMETERS HWND, nMsg, wParam, lParam
** GESTUREINFO return structure on 32 bit systems
**//
** Field Sizes & Offsets (32-bit)
** Field Type Size(Bytes) Offset Notes
** cbSize UINT 4 0
** dwFlags DWORD 4 4
** dwID DWORD 4 8
** hwndTarget HWND 4 12 32-bit HWND
** ptsLocation POINTS 4 16 (SHORT x, y)
** dwInstanceID DWORD 4 20
** dwSequenceID DWORD 4 24
** ullArguments ULONGLONG 8 28 8-byte aligned (starts at 28)
** cbExtraArgs UINT32 4 36
** Padding (none) 8 40 Compiler adds 8 bytes to round up to 48
** Total: 48 bytes (40 usable + 8 padding)
**//
#DEFINE GID_START 1
#DEFINE GID_END 2
#DEFINE GID_ZOOM 3
#DEFINE GID_PAN 4
#DEFINE GID_ROTATE 5
#DEFINE GID_TWOFINGERTAP 6
#DEFINE GID_PRESSANDTAP 7
** Create buffer for the GESTUREINFO structure
dwSize = BINTOC(48, "4RS") && Size of the structure (always 48 bytes)
dwFlags = BINTOC(0, "4RS") && Default flags (0)
dwID = BINTOC(0, "4RS") && GID_PAN for pan gesture
hwndTarget = BINTOC(0, "4RS")
ptLocationX = BINTOC(0, "2RS") && Default location (X = 0)
ptLocationY = BINTOC(0, "2RS") && Default location (Y = 0)
dwInstanceID = BINTOC(0, "4RS")
dwSequenceID = BINTOC(0, "4RS")
ullArguments = BINTOC(0, "8RS")
cbExtraArgs = BINTOC(0, "4RS")
padding = BINTOC(0, "8RS")
** Combine the parts into a single binary string
gestureInfo = dwSize + dwFlags + dwID + hwndTarget + ptLocationX + ptLocationY + dwInstanceID + dwSequenceID + ullArguments + cbExtraArgs + padding
** Get result
lnResult = GetGestureInfo(lParam, @gestureInfo)
IF lnResult = 1
** API Returned OK
** Extract relevant into. We only need dwID and ptLocationX/Y
*dwSize = CTOBIN(SUBSTR(gestureInfo, 1, 4), "4rs")
*dwFlags = CTOBIN(SUBSTR(gestureInfo, 5, 4), "4rs")
dwID = CTOBIN(SUBSTR(gestureInfo, 9, 4), "4rs")
*hwndTarget = CTOBIN(SUBSTR(gestureInfo, 13, 4), "4rs")
ptLocationX = CTOBIN(SUBSTR(gestureInfo, 17, 2), "2rs")
ptLocationY = CTOBIN(SUBSTR(gestureInfo, 19, 2), "2rs")
*dwInstanceID = CTOBIN(SUBSTR(gestureInfo, 21, 4), "4rs")
*dwSequenceID = CTOBIN(SUBSTR(gestureInfo, 25, 4), "4rs")
*ullArguments = CTOBIN(SUBSTR(gestureInfo, 33, 8), "8rs")
DO CASE
CASE dwID = GID_START
** Handle start of pan gesture. Save initial X/Y position
THIS.ptlocationy_initial = ptLocationY
THIS.ptlocationx_initial = ptLocationX
CASE dwID = GID_PAN
** Handle gesture in progress. Calculate dY/dX and apply to the viewport
dy = ptLocationY - THIS.ptlocationy_initial
dx = ptLocationX - THIS.ptlocationx_initial
THISFORM.SETVIEWPORT(0, IIF((THISFORM.VIEWPORTTOP - dy) < 0, 0, THISFORM.VIEWPORTTOP - dy))
THIS.ptlocationy_initial= ptLocationY
THIS.ptlocationx_initial= ptLocationX
ENDCASE
ENDIF
CloseGestureInfoHandle(lParam)