property G2antt.WordFromPoint (X as OLE_XPOS_PIXELS, Y as OLE_YPOS_PIXELS, Highlight as Boolean, [Reserved as Variant]) as String
Retrieves the word from the cursor.

TypeDescription
X as OLE_XPOS_PIXELS A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates.
Y as OLE_YPOS_PIXELS A single that specifies the current X location of the mouse pointer. The x values is always expressed in client coordinates.
Highlight as Boolean A Boolean expression that indicates whether the word from the position is highlighted.
Reserved as Variant A long expression that specifies the part/parts of the control to search for the word from the cursor.
String A String expression that indicates the word from the cursor.
Use the WordFromPoint property to retrieve the word from the cursor. The X and Y coordinates are expressed in client coordinates, so a conversion must be done in case your coordinates are relative to the screen or to other window. If the X parameter is -1 and Y parameter is -1 the WordFromPoint property determines the index word from the cursor. By default, the WordFromPoint property looks for the words in the Items area but it can search for words in any part of the control (Reserved parameter). Shortly, in the area where the items are displayed. A word is being defined as the sequence of the characters between two space/tab characters ( empty characters ). The word being returned does not include any HTML tags, in case the cursor hovers an HTML text. Use the ItemFromPoint property to get the item or cell from the cursor. Use the BarFromPoint property to get the bar from the point. Use the LinkFromPoint property to get the link from the point.  Use the AnchorFromPoint property to determine the identifier of the anchor from the point. Use the CellCaption property to retrieve the entire cell's caption. Use the CellValue property to retrieve the cell's value. The ShowToolTip property shows programmatically your text as a tooltip. 

The following VB sample displays the word from the cursor:

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Debug.Print G2antt1.WordFromPoint(-1, -1)
End Sub

The following VB sample highlights the word from the cursor, as soon as the cursor hovers a word:

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Debug.Print G2antt1.WordFromPoint(-1, -1, True)
End Sub

The following screen shot shows the "Team" word being highlighted when the cursor hovers it:

As soon as the cursor hovers another word it gets highlighted.  The highlighting is temporary so as soon as the control is repainted the highlight is lost. For instance, you resize a column, scroll, or select a new item.

The following VB sample highlight the word from the cursor, and displays a context menu ( eXPopupMenu ) when the user right clicks the control:

Private Sub G2antt1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Debug.Print G2antt1.WordFromPoint(-1, -1, True)
End Sub

Private Sub G2antt1_RClick()
    Dim i As Long
    With PopupMenu1.Items
        .Clear
        .Add G2antt1.WordFromPoint(-1, -1, True)
    End With
    i = PopupMenu1.ShowAtCursor()
End Sub

Currently, the Reserved parameter could be a combination ( bitwise OR ) of any of the following:

  • (1) - Items area ( the area where the items are shown )

  • (2) - Header area ( the area where the column's caption is displayed )

  • (4) - SortBar area ( the part of the control that shows the sorting columns, if multiple columns sorting is enabled )

  • (8) - FilterBar area ( the part of the control that displays the filter bar )

  • (256) - Histogram area ( the part of the control that displays the chart's histogram )

For instance, if the Reserved parameter is 1 + 2 (3), the WordFromPoint property retrieves the word from Items or Header area as well. If missing the control looks for the word in the Items section.