Do you have any tips on making the Sgrid show a tooltip of the contents of the cell? |
Here's some basic code which does it:
Private Sub grdThis_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim xP As Long
Dim yP As Long
Dim lRow As Long
Dim lCol As Long
xP = Me.ScaleX(x, Me.ScaleMode, vbPixels)
yP = Me.ScaleY(y, Me.ScaleMode, vbPixels)
If (yP > grdThis.HeaderHeight) Then
grdThis.CellFromPoint xP, yP, lRow, lCol
If (lRow > 0) And (lCol > 0) Then
On Error Resume Next
grdThis.ToolTipText = grdThis.CellText(lRow, lCol)
If (Err.Number <> 0) Then
grdThis.ToolTipText = ""
Else
Exit Sub
End If
End If
End If
grdThis.ToolTipText = ""
End Sub
The only problem with this is that the tooltip may still display when the user is over the scroll bars. I need to update CellFromPoint to deal with that. I should probably add tooltip functionality to the grid as a whole.
|