Partager via


Timeline of Mouse Messages and System Events

Timeline of Mouse Messages and System Events

Overview of timeline of mouse messages and system events.

To successfully use mouse messages and system events in your application, you must understand the order of events and the timeline of their occurrences. This helps you to design your application to respond adequately and to the correct events based on the context of the action.

Note: Both pen events and mouse messages are sent to an application, regardless of whether the pen or the mouse is used.

When a given action is performed, the system events (prefixed with ISG_) are sent and received almost instantaneously by the application. The mouse messages (prefixed with WM_) are sent when the action is performed and are received by the application after the time it takes for the event to be processed by the Microsoft® Windows® messaging service. In addition, CursorDown and CursorUp are pen events that are received from the pen hardware. They are sent when the tablet pen touches the screen and when it is lifted from the screen, respectively.

Note: For the hold through event sequence, if the user drags the tablet pen before the sequence is complete, the events that are sent correspond to left-drag. For example, when the drag starts, ISG_DRAG and WM_LBUTTONDOWN are sent. When the pen is eventually lifted, CursorUp and WM_LBUTTONUP are sent.

The following chart shows the sequence of system and mouse events that are sent.

tpcsdkua_tpc_uxdg_pen_as_mouse_events.jpg

A double-tap with a tablet pen is often less accurate than a double-click with a mouse. This comes from the inherent nature of performing a double-tap with a tablet pen. Because the user must lift the tablet pen to perform a double-tap, the time between taps is often greater than the corresponding time between clicks of a double-click. In addition, it is likely that the two taps of the tablet pen occur at screen coordinates that are further apart than those for the two clicks of the mouse. To accommodate this, Windows XP Tablet PC Edition has settings for the temporal and spatial distance between the two taps of a double-tap that are separate from the mouse settings for a double-click. These settings can be adjusted in Tablet and Pen Settings in Control Panel.

Pen events and mouse messages are not synchronized. There is no guarantee that corresponding mouse messages and pen events (such as WM_LBUTTONDOWN and ISG_TAP, or WM_LBUTTONDBLCLK and ISG_DBLTAP) will occur in a particular order. The relationship between these messages is complex. Thus, if your application listens for both pen and mouse messages it is difficult to predict the relationship of the messages and hence the eventual behavior. Because of these considerations, applications should listen to only one set of messages rather than both. If you are building a pen-enabled application, listen only to the system and pen messages. These messages are predictable and work well with the tablet pen. If you are building an application that is not pen-enabled, listen only for the mouse messages.