Compartir a través de


SetGestureStatus Method [InkEdit Control]

SetGestureStatus Method [InkEdit Control]

Sets the interest of the InkEdit control in a known application gesture.

Declaration

[C++]

HRESULT SetGestureStatus (
    [in] InkApplicationGesture gesture,
    [in] VARIANT_BOOL gestureStatus
);

[Microsoft® Visual Basic® 6.0]

Public Sub SetGestureStatus( _
    gesture As InkApplicationGesture, _
    gestureStatus As Boolean _
)

Parameters

gesture

[in] The IInkGesture object that you want the status of.

gestureStatus

[in] A Boolean value that indicates whether the InkEdit control has interest in a known application gesture.

Value Description
True The InkEdit control uses the application gesture.
False The InkEdit control does not use the application gesture.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER The input parameter was incorrect.
E_INK_INVALID_MODE InkEdit status must be IES_Idle.
E_INK_EXCEPTION An exception occurred.
TPC_S_TRUNCATED Unsupported gesture.
E_INVALIDARG The flag is invalid.
E_OUTOFMEMORY Cannot allocate memory operation.

Remarks

The AllGestures gesture is not supported by the InkEdit control and returns an error. Passing invalid gesture identifiers does not return an error.

This method should only be called if the InkEdit::Status property returns IES_Idle.

To get the interest of the InkEdit control in a known gesture, call the InkEdit::GetGestureStatus method.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example turns off most application gestures and then enables the chevron gestures. The example displays application and system gesture event information in a multiline text edit control, Text1, on the main form window.

Private Sub Form_Load()
    'Set the ink collection mode to collect ink and gestures,
    'and turn off all application gestures except the chevrons.
    InkEdit1.CollectionMode = ICM_InkAndGesture
    InkEdit1.SetGestureStatus IAG_AllGestures, False
    InkEdit1.SetGestureStatus IAG_ChevronUp, True
    InkEdit1.SetGestureStatus IAG_ChevronDown, True
    InkEdit1.SetGestureStatus IAG_ChevronLeft, True
    InkEdit1.SetGestureStatus IAG_ChevronRight, True
    InkEdit1.Enabled = True

    InkEdit1.SetEventInterest ICEI_SystemGesture, True
End Sub

Private Sub InkEdit1_Gesture( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Strokes As MSINKAUTLib.InkStrokes, _
ByVal Gestures As Variant, _
Cancel As Boolean)
    Dim theGesture As Variant
    Dim X As Long
    Dim Y As Long
    Text1.Text = ""
    For Each theGesture In Gestures
        theGesture.GetHotPoint X, Y
        Text1.Text = Text1.Text & "Gesture " & _
        AppGestureName(theGesture.Id) & _
        " at (" & X & "," & Y & ") confidence: " & _
        ConfidenceName(theGesture.Confidence) & vbCrLf
    Next
End Sub

Private Sub InkEdit1_SystemGesture( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Id As MSINKAUTLib.InkSystemGesture, _
ByVal X As Long, ByVal Y As Long, _
ByVal Modifier As Long, _
ByVal Character As String, _
ByVal CursorMode As Long)
    Text1.Text = "SystemGesture " & _
    SystemGestureName(Id) & " (x:" & X & ",y:" & Y & ")"
End Sub

Private Function SystemGestureName(ByVal Id As InkSystemGesture) As String
    Select Case Id
        Case ISG_DoubleTap
            SystemGestureName = "ISG_DoubleTap"
        Case ISG_Drag
            SystemGestureName = "ISG_Drag"
        Case ISG_HoldEnter
            SystemGestureName = "ISG_HoldEnter"
        Case ISG_HoldLeave
            SystemGestureName = "ISG_HoldLeave"
        Case ISG_HoverEnter
            SystemGestureName = "ISG_HoverEnter"
        Case ISG_HoverLeave
            SystemGestureName = "ISG_HoverLeave"
        Case ISG_RightDrag
            SystemGestureName = "ISG_RightDrag"
        Case ISG_RightTap
            SystemGestureName = "ISG_RightTap"
        Case ISG_Tap
            SystemGestureName = "ISG_Tap"
        Case Else
            SystemGestureName = "SystemGesture(" & Id & ")"
    End Select
End Function

Private Function AppGestureName(ByVal Id As InkApplicationGesture) _
As String
    Select Case Id
        Case IAG_AllGestures
            AppGestureName = "IAG_AllGestures"
        Case IAG_NoGesture
            AppGestureName = "IAG_NoGesture"
        Case IAG_ChevronUp
            AppGestureName = "IAG_ChevronUp"
        Case IAG_ChevronDown
            AppGestureName = "IAG_ChevronDown"
        Case IAG_ChevronLeft
            AppGestureName = "IAG_ChevronLeft"
        Case IAG_ChevronRight
            AppGestureName = "IAG_ChevronRight"
        Case Else
            AppGestureName = "AppGesture(" & Id & ")"
    End Select
End Function

Private Function ConfidenceName(ByVal Id As InkRecognitionConfidence) _
As String
    Select Case Id
        Case IRC_Strong
            ConfidenceName = "IRC_Strong"
        Case IRC_Intermediate
            ConfidenceName = "IRC_Intermediate"
        Case IRC_Poor
            ConfidenceName = "IRC_Poor"
        Case Else
            ConfidenceName = "Confidence(" & Id & ")"
    End Select
End Function

Applies To