Condividi tramite


System Events and Mouse Messages

System Events and Mouse Messages

Overview of system events and mouse messages.

Your application incorporates optimal design and usage of the tablet pen by sending both Microsoft® Windows® mouse messages and system events. Applications receive both sets of events for each pen movement or action. The application then chooses the appropriate event to use based on the context of the action. Windows mouse messages work well for pointing and selecting activities, and you should use them for activities that involve interaction with user interface (UI) elements. Pen events work well for real-time ink application, pen actions, and handwriting.

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

When you receive the WM_LBUTTONDOWN message, your application can call the Win32 application programming interface (API), GetMessageExtraInfo Function Leave Site. If this API returns 0xFF515700, then this mouse message was generated when a tablet pen was tapped. In all other cases, you can assume that this message was generated by a physical mouse.

The following table lists system gestures currently included in Windows XP Tablet PC Edition, details the corresponding pen actions and system events, and shows how they relate to traditional mouse actions.

Pen gesture Mouse action Pen gesture description Event messages Mouse messages Behaviors in Windows-based applications
Tap Left-click Tap the screen once with the pen. ISG_TAP sent when pen is lifted. WM_LBUTTONDOWN and WM_LBUTTONUP sent when pen lifted. Choose command from menu or toolbar, take action if command chosen, set insertion point (IP), show selection feedback.
Double-tap Double-click Tap screen twice in quick succession. ISG_DOUBLETAP sent on second tap (down). ISG_TAP event sent on the first tap. WM_LBUTTONDBLCLK sent on second tap (down). WM_LBUTTONDOWN and WM_LBUTTONUP sent on first tap (up) as for a single tap. Select word, open file or folder.
Press and hold Right-click Tap the screen and hold until a mouse icon appears, and then lift the pen to display a shortcut menu. An application could choose to perform an action different from showing a right-click menu when the pen is lifted. ISG_HOLDENTER sent when the pen has been down long enough. ISG_RIGHTTAP sent when pen is lifted and right-click occurs. WM_RBUTTONDOWN and WM_RBUTTONUP sent when right click occurs (when pen is lifted). Show shortcut menu.
Hold-through Left-click Tap the screen and hold until the mouse icon appears and disappears. Users are likely to do this when they accident-tally press and hold and want to revert to just tap. ISG_TAP sent when pen is lifted. WM_LBUTTONDOWN and WM_LBUTTONUP sent when pen is lifted. Left-click for a long time. No mouse equivalent exists. This is a fallback for when a user performs press-and-hold for a long time. The event reverts to being a tap.
Drag Left-drag Tap the screen to select the object that is to be moved, and then drag after the object is selected. ISG_DRAG sent when drag starts. WM_LBUTTONDOWN sent when drag starts, followed by a series of mouse move messages, followed by a WM_LBUTTONUP event. Drag-select, as in Microsoft Word when starting with an IP; select multiple words; drag, as when dragging an object in Windows; scrolling.
Press and hold followed by a drag Right-drag Tap the screen to select the object that is to be moved. Hold until the mouse icon appears, and then drag to move the object. Lift the pen to display a shortcut menu. ISG_HOLDENTER sent when pen has been down for some time. ISG_RIGHTDRAG sent when drag starts. WM_RBUTTONDOWN sent when drag starts, followed by a series of mouse move messages, followed by a WM_RBUTTONUP event. Drag, as when dragging an object or selection followed by a context menu.
Pen hover Mouse hover Hold the pen steady at a small distance from the screen. ISG_HOVERENTER event sent initially. When hover interval is completed, ISG_HOVERLEAVEis sent. No mouse message equivalent. Show ToolTip, roll-over effects, and other mouse hover behaviors.
In-air shake Show Tablet PC Input Panel. No mouse equivalent. Move the pen quickly from side to side, holding the tip above, but within range of, the screen. Event is not passed to the application. No mouse message equivalent. New, specific to Tablet PC.