Results 1 to 2 of 2

Thread: Mouse Over Tool Tip Text

  1. #1

    Thread Starter
    Hyperactive Member venkatraman_r's Avatar
    Join Date
    Jul 1999
    Location
    Chennai, INDIA
    Posts
    284

    Post

    Hi,

    Recently, I saw a message explaining how to get the tool tip text for a list box item without selecting it. Like what Microsoft had done it in VB Books on line. Can anyone please let me know where it is?

    Thanx.

    Venkat.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Sure thing. Put this on Listbox MouseMove event:
    Code:
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const LB_GETITEMHEIGHT = &H1A1
    
    
    Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim intItemIndex As Integer
        Dim strItem As String
        Dim lngItemHeight As Long
        
        'Get the height og the item in the list
        lngItemHeight = SendMessage(List1.hwnd, LB_GETITEMHEIGHT, 0, 0)
        'Get the index of the item your mouse is over
        intItemIndex = List1.TopIndex + (Y \ (lngItemHeight * Screen.TwipsPerPixelY))
        If intItemIndex > List1.ListCount - 1 Then Exit Sub
        strItem = List1.List(intItemIndex)
        List1.ToolTipText = strItem
    End Sub
    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 12-02-1999).]

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