Results 1 to 3 of 3

Thread: Set ToolTip for ListView

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Jacksonville
    Posts
    23

    Cool

    Is there way to capture what cell of ListView the mouse is on and then display the tooltip displaying the data of that
    cell. Actually you can strech the cell to see the data but since data is too long i want to use tool tip to display the whole string.
    Thanks!

  2. #2
    Guest
    Use the ListView's ToolTipText and SelectedItem properties to display the item that the mouse is over (but, it has to be selected).

    Code:
    Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    ListView1.ToolTipText = ListView1.SelectedItem
    End Sub

  3. #3
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    I needed to only display the tooltip if the mouse was over the selected item, though, so as to simulate normal tooltip behavior.

    This is what I came up with...

    In item in a ListView (lvwList type) appears to be approximately 210 units high.

    Code:
    Private Sub ListView1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
       If (y > (ListView1.SelectedItem.Index * 210 + 60) And (ListView1SelectedItem.Index * 210 + 270) Then
            ListView1.ToolTipText = ListView1.SelectedItem
       Else
            ListView1.ToolTipText = ""
       End If
    End Sub
    The 60 is an offset to account for the header row.
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width