Type | Description | |||
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. |
The following VB sample displays the word from the cursor:
Private Sub Grid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Debug.Print Grid1.WordFromPoint(-1, -1) End Sub
The following VB sample highligths the word from the cursor, as soon as the cursor hovers a word:
Private Sub Grid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Debug.Print Grid1.WordFromPoint(-1, -1, True) End Sub
The following screen shot shows the "rows" 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 Grid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Debug.Print Grid1.WordFromPoint(-1, -1, True) End Sub Private Sub Grid1_RClick() Dim i As Long With PopupMenu1.Items .Clear .Add Grid1.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 )
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.