CursorOutOfRange Event

CursorOutOfRange Event

Occurs when the cursor leaves the physical detection range (proximity) of the tablet context.

Declaration

[C++]

void CursorOutOfRange([in] IInkCursor* Cursor);

[Microsoft® Visual Basic® 6.0]

Public Event CursorOutOfRange( _
    Cursor As IInkCursor _
)

Parameters

Cursor

[in] The IInkCursor object that generated the CursorOutOfRange event.

Remarks

This event method is defined in the _IInkCollectorEvents, _IInkOverlayEvents, and _IInkPictureEvents dispatch-only interfaces (dispinterfaces) with an ID of DISPID_ICECursorOutOfRange.

The CursorOutOfRange event is fired even when in select or erase mode, not just when in ink mode. This requires that you monitor the editing mode (which you are responsible for setting) and be aware of the mode before interpreting the event. The advantage of this requirement is greater freedom to innovate on the platform through greater awareness of platform events.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example demonstrates using event handlers to display the state of the cursor buttons and whether the cursor is in or out of range. This simple application has a text edit control, Text1, where messages appear when events are received.

Option Explicit
Dim WithEvents theInkCollector As InkCollector

Private Sub Form_Load()
    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.Enabled = True

    theInkCollector.SetEventInterest ICEI_CursorButtonUp, True
    theInkCollector.SetEventInterest ICEI_CursorButtonDown, True
End Sub

Private Sub theInkCollector_CursorButtonUp( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Button As MSINKAUTLib.IInkCursorButton)
    Text1.Text = _
    "Cursor " & Cursor.Name & "." & Button.Name & " button up"
End Sub

Private Sub theInkCollector_CursorButtonDown( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Button As MSINKAUTLib.IInkCursorButton)
    Text1.Text = _
    "Cursor " & Cursor.Name & "." & Button.Name & " button down"
End Sub

Private Sub theInkCollector_CursorInRange( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal NewCursor As Boolean, _
ByVal ButtonsState As Variant)
    Text1.Text = _
    "Cursor " & Cursor.Name & " in range, NewCursor is " & NewCursor
End Sub

Private Sub theInkCollector_CursorOutOfRange( _
ByVal Cursor As MSINKAUTLib.IInkCursor)
    Text1.Text = "Cursor " & Cursor.Name & " out of range"
End Sub

Applies To