Scroll Gestures (Compact 7)
3/12/2014
A scroll, or flick, gesture (gesture type GID_SCROLL) occurs when the user touches the screen, moves his finger more quickly than the flick threshold, and releases the touch immediately afterward.
An application that handles the scroll gesture will typically use the physics engine to calculate positions of the object that scrolls.
If your application does not process a scroll event, it will be forwarded to the default windows procedure and then to the default gesture handler. The default gesture handler creates a physics engine object with a timer and callback. At each timer callback, the physics engine calculates the new position and generates a sequence of WM_VSCROLL/WM_HSCROLL messages for the window, causing the window to scroll its contents accordingly.
GESTUREINFO member ullArguments contains additional information about the angle, direction, and velocity of the flick. The following example code shows how to extract these values.
GESTUREINFO gci;
HGESTUREINFO hGestureInfo;
gci.cbSize = sizeof(GESTUREINFO);
hGestureInfo = reinterpret_cast<HGESTUREINFO>(lParam);
GetGestureInfo(hGestureInfo, &gci);
LONG lScrollAngle = GID_SCROLL_ANGLE(gi.ullArguments);
ULONG ulScrollDirection = GID_SCROLL_DIRECTION(gi.ullArguments);
LONG lScrollVelocity = GID_SCROLL_VELOCITY(gi.ullArguments);
The definitions for the GID_SCROLL_ANGLE, GID_SCROLL_DIRECTION and GID_SCROLL_VELOCITY macros are in Winuser.h.
The ulScrollDirection is left, right, up, down, or no direction.
// Scroll directions
#define ARG_SCROLL_NONE 0
#define ARG_SCROLL_DOWN 1
#define ARG_SCROLL_LEFT 2
#define ARG_SCROLL_UP 3
#define ARG_SCROLL_RIGHT 4