The NTouch static class manages the touch virtual device in NOV and serves as UI event dispatcher for native touch events, that a particular window peer receives. Because there may be multiple touch devices (fingers) sending information simultaneously, the NTouch static class manages a set of NTouchDevice instances, each of which represents an active touch device (finger). Following is a description of the touch related features and services:
Touch device capture has two aspects – native and virtual. In order for an input target to actually gain touch device capture, the peer of the window in which it resides must first gain native touch device capture (i.e. the touch device must first be captured in the native presentation layer).
The part of the touch device capturing that deals with the actual window peer touch device capture is referred as native touch device capture. When native mouse capture is obtained, all touch device action events are natively routed to the window of the input target.
Since NTouch is the front end for all touch device events that arrive in NOV, it additionally redispatches the events to the current input target that has touch device capture. This part of touch device capturing is referred as virtual touch device capture, since the native presentation layer plays no role in this process. You typically never deal directly with the touch device capture abilities of NMouse, but rather use the methods of the NInputElement class (see Input Elements for more info).
Certain presentation layers in which NOV integrates will promote unhandled touch events to mouse events. To disable this feature you can turn the NTouch.EnableMouseEventsPromotion property to false:
Disable Mouse Events Promotion |
Copy Code
|
NTouch.EnableMouseEventsPromotion = false;
|
The NTouch static class manages the currently active set of NTouchDevice instances. You can get the currently active devices with the help of the NTouch.GetActiveDevices method:
Get the Active Touch Devices |
Copy Code
|
NTouchDevice[] activeDevices = NTouch.GetActiveDevices();
|
Additionally each touch device exposes the following properties:
- CaptureTarget - gets the node on which the touch device is currently captured on (if any)
- IsDown - gets whether the touch device is down (pressed)
- IsPrimary - gets whether the touch device is currently the primary touch device (the first one)
- TouchOrdinal - gets the ordinal of the touch device.
- ScreenPosition - gets the screen position of the touch device.