The Language Reference section contains descriptions of programming elements such as touch events, gestures, and gesture animations.
The touch API is divided into two parts, managing the gesture API for touch input, and the physical engine API that controls how the display area responds to the user's touch.
Touch functions, messages, and structs are shared with the mouse because the application handles stylus events like a left mouse click. To learn more about other touch reference information, go to the mouse reference.
Index
Touch gestures introduce the touch of the window and discuss how to implement the touch interface in your application.
Gesture Reference (DTK) This API allows your program to monitor touch input and program touch input.
The physical engine overview describes the physical engine and how to use it when implementing physical excuses.
Physical engine Reference (DTK) This API controls how the screen responds to touch input and allows your application to respond to touch like a shell.
Touch gestures
A touch gesture is described as a brief, directional move made on a control or object on the screen by your finger or stylus. Most of the gestures are a separate click. Therefore, they are equal to one finger?down (Wm_lbuttondown) and finger?up (wm_lbuttonup) pairs. The exception is double Tap, which contains two pairs of briefly contiguous Finger?down (Wm_lbuttondown) and Finger?up (Wm_lbuttonup). Gesture recognition is based on Finger?down and Finger?up events, plus the direction, position, and speed computed by the gesture recognizer. Windows Mobile supports the following five kinds of gestures.
Gesture Description
The TapTap is displayed as a left mouse button click.
When a Finger?down event and a Finger?up event occur at a specified time period, a specific distance occurs, the application receives a separate gid_select gesture message. After the Wm_lbuttondown event, there may be several wm_mousemove messages before the Gid_select message.
Double tapdouble tap is shown as the left mouse button double click.
The application receives a GID_DOUBLESELECT message when two finger?up events occur within a specified time period and at a specific distance.
Hold users can press and hold on the screen to indicate a right mouse click.
The application receives a gid_hold message when the finger remains pressed over the specified time and all points are within a specific distance. When the finger is raised or hold time reaches the limit, a gid_end message is followed.
Flick users can move their fingers across the screen to start scrolling by pixel, and if they move fast enough, scrolling continues after the fingers are raised.
At the end of the finger slide, the application receives a separate gid_scroll gesture message. Flick occurs frequently after the pan (one or more gid_pan messages, followed by a gid_scroll message, followed by a gid_end message).
The pan user can press the finger on the screen and keep the state pressed, and then drag the finger in any direction to indicate the mouse drag event.
When the position of the finger changes, the application receives one or more Gid_pan messages, followed by a gid_end message when the finger is raised. The mouse message is alternating with the gesture message. Panning can occur after a hold gesture.
For more information on gid_* gestures, please refer to Gestureinfo.
The system architecture of the gesture recognition engine consists of a gesture recognition state machine attached to an existing touch event. The touch event is transferred from the touchscreen drivers to the state machine. When gestures are recognized, a window message is sent to the message queue of the target process.
Note: Calling SetCapture will change the target window of the gesture.
Gesture events are usually passed before any finger?up, allowing the receiver to handle the gesture by calling Tkgetgestureinfo and canceling any scheduled action against the Finger?up touch event.
Window automatic gesture
Automatic gestures enable controls and applications within the window to handle flick and pan gestures automatically. You can control gesture processing by using function Tksetwindowautogesture and tkgetwindowautogesture. Automatic gestures enable the active message that will be sent to the window program to manage the flick and Pan cross triggers. You can retrieve these messages by calling Tkgetanimatemessageinfo.
Gesture Reference (DTK)
The window's automatic gesture enables the contents of the window to be able to automatically scroll the response of the flick and pan gestures. This Language Reference section contains a description of the technical programming essentials.
The contents of this section
The gesture function (DTK) provides an overview of the related functions of touch gestures.
The gesture structure Body (DTK) provides an overview of touch gesture-related structures.
Gesture Macros (DTK) provide an overview of the macros associated with touch gestures.
Gesture Constants (DTK) provide an overview of gesture-related functions.
Gesture messages (DTK) provide an overview of the messages associated with touch gestures.
Gesture Constants (DTK)
The following constants are used as commands for the GESTUREINFO structure.
Name Value Description
The gid_begin1 contains the coordinates that identify the start point of the touch gesture. When the screen is touched, it is sent.
The gid_end2 contains the coordinates that identify the end point of the touch gesture. When a finger or stylus leaves the screen, it is emitted.
The parameter fields of the Gestureinfo are often set to zero by this command.
Gid_pan4 the pan occurs when the user presses the window, keeps the finger and screen in contact and moves in any direction. The identification engine sends a GID_PAN message containing the starting position and the current position. For each mouse move message, a new Gid_pan message will be sent until the finger or stylus leaves the window.
Gid_end is used to identify the end position of the pan movement.
The application can calculate a moving trajectory from the difference between two consecutive pan gestures.
If the Gf_inertia flag is set, the value of the Gestureinfo parameter field is the same as Gid_scroll.
Gid_scroll8 occurs when a user presses (or crosses a screen) on a window, and then moves quickly in any direction before the finger or stylus is lifted. Scroll
The identification engine emits gid_scroll messages after flick gestures.
Gid_scroll is sent to the first gesture message that receives the current touch session, such as a pan message or a hold message window.
The Gestureinfo parameter field contains information about the angle, direction, and flick speed.
The direction of the core is represented by the following values:
Arg_scroll_none
Arg_scroll_right
Arg_scroll_up
Arg_scroll_left
Arg_scroll_down when the device rotates, the gesture adjusts to fit the rotation.
The flick angle is measured by the value of the 0~65535.
The following macro extracts the angle, direction, and speed from the original angle:
Gid_scroll_angle
Gid_scroll_direction
Gid_scroll_velocity
You can use the following macro to convert between angles and radians: gid_rotate_angle_to_argument
Gid_rotate_angle_from_argument
GID_HOLD9 occurs when the user presses and holds the finger or stylus on the window longer than the hold timeout.
The identification engine sends a gid_hold gesture message and follows a gid_end message when the finger or stylus is raised.
Hold gestures can be followed by a pan that generates several Gid_pan messages, but gid_hold messages never occur after the Gid_pan message.
Gid_select10 selection occurs when the user slaps the screen with a finger or stylus and the event is shorter than the select timeout.
The Gestureinfo parameter field is not available for this command.
GID_DOUBLESELECT11 selection occurs when a user clicks the screen two times with a finger or stylus within a specified doubleselect timeout. This timeout occurs between successive mouse-bouncing events.
The Gestureinfo parameter field is not available for this command.
Gesture function (DTK)
Gesture Macros (DTK)
Gesture Message (DTK)
Gesture Structural body (DTK)
2010.4.12 Supplementary Note:
Originally prepared to complete the translation of this document, but today suddenly found that this document has been translated by friends. Then I have no need to repeat the manufacture of wheels, the Internet to create information waste. So the translation of this document ends here and no longer continues.
To see the full translation, please go to the blog park, the friend's blog, Windows Mobile space. Of course, this is primarily for local code development because the gesture API is a local API.
Microsoft's two-bit engineers (Alex Yakhnin, Ron Buckton) encapsulate the two local APIs, and open source provides their version of managed code. You can download the DLL or source code here, Alex Yakhnin's blog page also provides the corresponding webcast video tutorials link.