GefEventContext.HighlightReason (read-only property)

Gets the reason for a highlight event.
Syntax: GefHighlightReasonEnum = object.HighlightReason
Description: This method is only valid for events of type gefEventHighlight and gefEventUnhighlight. It returns gefHighlightMouseMove if the mouse was moved, gefHighlightKeyPress if TAB, Shift+TAB, or one of the arrow keys was pressed, and gefHighlightOther for other cases.

Example:

Sub GefEventContext_HighlightReason()
    
    Dim oCimEvntContxt As GefEventContext
    Set oCimEvntContxt = CimGetEventContext
    If oCimEvntContxt.Type = gefEventUnhighlight Or _
          oCimEvntContxt.Type = gefEventHighlight Then
        Select Case oCimEvntContxt.HighlightReason
            Case gefHighlightKeyPress
                MsgBox "The object is highlighted because of " & _
                    "a key press event"
            Case gefHighlightMouseMove
                MsgBox "The object is highlighted because of " & _
                    "a mouse move event"
            Case gefHighlightOther
                MsgBox "The object is highlighted for other " & _
                    "reasons"
        End Select
    Else
        MsgBox "Highlight reason is not supported for this " & _
            "event type"
    End If
    
End Sub