System Events and Mouse Messages

System Events and Mouse Messages

1 out of 6 rated this helpful Rate this topic

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.

Distinguishing Pen Input from Mouse and Touch

When your application receives a mouse message (such as WM_LBUTTONDOWN), it may call the GetMessageExtraInfo function to evaluate whether the message originated from a pen or a mouse device.

The value returned from GetMessageExtraInfo needs to be mask-checked against 0xFFFFFF00, and then compared with 0xFF515700. The following definitions may make this clearer:

#define MI_WP_SIGNATURE<entity type="nbsp"/> 0xFF515700
#define SIGNATURE_MASK<entity type="nbsp"/><entity type="nbsp"/> 0xFFFFFF00
#define IsPenEvent(dw)<entity type="nbsp"/><entity type="nbsp"/> (((dw) & SIGNATURE_MASK) == MI_WP_SIGNATURE

If the comparison is true, then this mouse message was generated by a Tablet PC pen or touch screen. In all other cases, you can assume that this message was generated by a mouse device.

The lower 8 bits returned from GetMessageExtraInfo are variable. Of those bits, 7 (the lower 7, masked by 0x7F) are used to represent the cursor ID, zero for the mouse or a variable value for the pen ID.Additionally, in Windows Vista, the eighth bit, masked by 0x80, is used to differentiate touch input from pen input (0 = pen, 1 = touch).

Supported System Gestures

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, and 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

ShowTablet 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.

 

Specifying Stylus and Touch Interactions

By default, your window will receive all system gesture events and use the default interaction model. Some pieces of this model may interfere with your application, so you may disable them selectively by responding to the WM_TABLET_QUERYSYSTEMGESTURESTATUS Message in your WndProc.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值