Solved

Tooltip

Posted on 1998-09-13
2
136 Views
Last Modified: 2010-04-30
Hello,
On a listbox or combobox, I would like than a tooltiptext appears when the text is not completly visible.
How can I do this?
Thanks a lot
Nathalie
0
Comment
Question by:sidjey
2 Comments
 
LVL 1

Expert Comment

by:sen999
ID: 1434593
Have a label which will be invisible by default. whenever needed you make it visible true and set the left and top properties approriately. So that it will appear as a tool tip
0
 

Accepted Solution

by:
kambhampati earned 0 total points
ID: 1434594
hello sidjey ,
u use this code,  place a listbox on a form with name list1

'Module level declaration

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function SendMessageLong Lib _
    "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, _
     ByVal wMsg As Long, _
     ByVal wParam As Long, _
     ByVal lParam As Long) As Long

Public Const EM_LINEFROMCHAR = &HC9
Public Const EM_GETLINECOUNT = &HBA
Public Function ListTips(Button As Integer, Shift As Integer, X As Single, Y As Single, List1 As ListBox) As String
        Dim lXPoint As Long
        Dim lYPoint As Long
        Dim lIndex As Long
        If Button = 0 Then
            lXPoint = CLng(X / Screen.TwipsPerPixelX)
            lYPoint = CLng(Y / Screen.TwipsPerPixelY)
            With List1
                lIndex = SendMessage(.hwnd, 425, 0, ByVal ((lYPoint * 65536) + lXPoint))
                If (lIndex >= 0) And (lIndex <= .ListCount) Then
                    .ToolTipText = .List(lIndex)
                Else
                    .ToolTipText = ""
                End If
            End With
        End If
    End Function
'''



'Paste this in list1_mousemove event




Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
       ListTips Button, Shift, X, Y, List1
    End Sub

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question