Nevron Open Vision Documentation
User Interface / User Input / Touch Input
In This Topic
    Touch Input
    In This Topic
     About NTouch

    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:

     Events
    Event Description Event Arguments

    Touch Device Action Events

    NTouchDevice.MoveEvent Raised when the touch device is moved. The target is either the top-most target below the touch point or the current touch device capture target if the touch device is captured. The event is routed along the entire route from the target node to its root.  NTouchActionEventArgs
    NTouchDevice.DownEvent Raised when a touch device is down. The target is either the top-most target below the touch point or the current touch device capture target if the touch device is captured. The event is routed along the entire route from the target node to its root.  NTouchActionEventArgs
    NTouchDevice.UpEvent Raised when a touch device is up. The target is either the top-most target below the touch point or the current touch device capture target if the touch device is captured. The event is routed along the entire route from the target node to its root.  NTouchActionEventArgs

    Touch Device Over Target Events

    NTouchDevice.EnterEvent Raised when the touch device enters a new OVER target. The touch device OVER target is the top-most target below the touch point. The event is routed along the entire route from the target node to its root.  NTouchOverChangeEventArgs
    NTouchDevice.InEvent Raised after NTouchDevice.EnterEvent, but routed up to the last ancestor that was common between the previous touch device OVER target and the new one. NTouchOverChangeEventArgs
    NTouchDevice.OutEvent Raised before NTouchDevice.LeaveEvent, but routed up to the last ancestor that was common between the previous touch device OVER target and the new one. NTouchOverChangeEventArgs
    NTouchDevice.LeaveEvent Raised when the touch device leaves the current OVER target. The event is routed along the entire route from the target node to its root.  NTouchOverChangeEventArgs

    Touch Device Capture Target Events

    NTouchDevice.GotCaptureEvent Raised when the touch device is captured by a specific target. Further Touch Device Action Events will be raised for the capture target until the touch device capture is released. The touch device OVER target is tied to the touch device capture target. The event is routed along the entire route from the target node to its root.  NTouchCaptureChangeEventArgs
    NTouchDevice.CaptureInEvent Raised after NTouchDevice.GotCaptureEvent, but routed up to the last ancestor that was common between the previous touch device capture target and the new one. NTouchCaptureChangeEventArgs
    NTouchDevice.CaptureOutEvent Raised before NTouchDevice.LostCaptureEvent, but routed up to the last ancestor that was common between the previous touch device capture target and the new one. NTouchCaptureChangeEventArgs
    NTouchDevice.LostCaptureEvent Raised when a target looses touch device capture. Further Touch Device Action Events will be raised for the mouse over target. The mouse over target is also untied. The event is routed along the entire route from the target node to its root.  NTouchCaptureChangeEventArgs
     Touch Device Capture

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

     Mouse Events Promotion

    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;
    
     Ambient Information

    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.