User Interface / User Input / Mouse Input
In This Topic
    Mouse Input
    In This Topic
     About NMouse
    The NMouse static class manages the mouse virtual device in NOV UI and serves as UI event dispatcher for native mouse events, that a particular window peer may capture. Following is a description of the mouse related features and services.
     Events
    Event Description Event Arguments

    Mouse Action Events

    NMouse.MoveEvent Raised when the mouse is moved. The target is either the top-most target below the mouse pointer or the current mouse capture target if mouse is captured. The event is routed along the entire route from the target node to its root.  NMouseEventArgs
    NMouse.DownEvent Raised when a mouse button is pressed. The target is either the top-most target below the mouse pointer or the current mouse capture target if mouse is captured. The event is routed along the entire route from the target node to its root.  NMouseButtonEventArgs
    NMouse.UpEvent Raised when a mouse button is released. The target is either the top-most target below the mouse pointer or the current mouse capture target if mouse is captured. The event is routed along the entire route from the target node to its root.  NMouseButtonEventArgs
    NMouse.WheelEvent Raised when the mouse wheel is rotated. The target is either the top-most target below the mouse pointer or the current mouse capture target if mouse is captured. The event is routed along the entire route from the target node to its root.  NMouseWheelEventArgs

    Mouse Over Target Events

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

    Mouse Capture Target Events

    NMouse.GotCaptureEvent Raised when the mouse is captured by a specific target. Further Mouse Action Events will be raised for the capture target until the mouse capture is released. The mouse over target is tied to the mouse capture target. The event is routed along the entire route from the target node to its root.  NMouseCaptureChangeEventArgs
    NMouse.CaptureInEvent Raised after NMouse.GotCaptureEvent, but routed up to the last ancestor that was common between the previous mouse capture target and the new one. NMouseCaptureChangeEventArgs
    NMouse.CaptureOutEvent Raised before NMouse.LostCaptureEvent, but routed up to the last ancestor that was common between the previous mouse capture target and the new one. NMouseCaptureChangeEventArgs
    NMouse.LostCaptureEvent Raised when a target looses mouse capture. Further Mouse 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.  NMouseCaptureChangeEventArgs
     Extended Properties
    Property Description
    NMouse.DirectlyOverPropertyEx Set to true for the input target on which the mouse pointer is directly over.
    NMouse.OverPropertyEx Set to true for the input target on which the mouse pointer is directly over and all of its ancestors .
    NMouse.CapturedPropertyEx Set to true for the input target, which has the mouse capture.
    NMouse.CaptureWithinPropertyEx Set to true for the input target, which has the mouse capture and all of its ancestors.
     Mouse Capture
    Mouse capture has two aspects – native and virtual. In order for an input target to actually gain mouse capture, the peer of the window in which it resides must first gain native mouse capture (i.e. the mouse must first be captured in the native presentation layer). The part of the mouse capturing that deals with the actual window peer mouse capture is referred as native mouse capture. When native mouse capture is obtained, all mouse action events are natively routed to the window of the input target. Since NMouse is the front end for all mouse events that arrive in NOV, it additionally redispatches the events to the current input target that has mouse capture. This part of mouse capturing is referred as virtual mouse capture, since the native presentation layer plays no role in this process. You typically never deal directly with the mouse capture abilities of NMouse, but rather use the methods of the NInputElement class (see Input Elements for more info).
     Cursors and Tooltips

    NMouse is responsible for managing the cursors. To do that it opens a cursor requests session prior to raising the Move, Down or Up events, and closes the session after the event is raised. It is up to the DOM to request the cursor that it wishes by calling the NMouse.RequestCursor method. The first cursor that was requested during a cursor request session is applied to the window peer, which originally captured the mouse event. You can query whether it makes sense to call NMouse.RequestCursor by first calling NMouse.CanRequestCursor – it returns false if a cursor requests session is not opened or a cursor was already requested for this session. (see Cursors for more info)

    NMouse is responsible for managing the tooltips. Similarly to cursors it opens a tooltip requests session prior to raising the Move event, and closes the session after the event is raised. It is up to the DOM to request the tooltip that it wishes by calling the NMouse.RequestToolTip method. The first tooltip that was requested during a tooltip request session is shown over the window, the peer of which originally captured the mouse event. You can query whether it makes sense to call NMouse.RequestToolTip by first calling NMouse.CanRequestToolTip – it returns false if a tooltip requests session is not opened or a tooltip was already requested for this session. (see ToolTips for more info)

    Higher level support for cursors and tooltips is implemented by the NInputElement class, which allows you to specify the tooltip or cursor that it has by simply setting the Cursor and ToolTip properties (see Input Elements for more info).

     Ambient Information

    At any time the screen position of the mouse can be obtained by the NMouse.ScreenPosition property.

    The NMouse also provides several methods for helping you obtain the current value of the extended properties that it has applied to a particular node. These are:

    • NMouse.IsDirectlyOver(NNode node) - returns the current value of the NMouse.DirectlyOverPropertyEx extended property for the specified node.
    • NMouse.IsOver(NNode node) - returns the current value of the NMouse.OverPropertyEx extended property for the specified node.
    • NMouse.IsCaptured(NNode node) - returns the current value of the NMouse.CapturedPropertyEx extended property for the specified node.
    • NMouse.IsCaptureWithin(NNode node) - returns the current value of the NMouse.CaptureWithinPropertyEx extended property for the specified node.