Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Tool tips equivalent

Posted on 1999-01-29
5
Medium Priority
?
216 Views
Last Modified: 2010-05-03
I want to be able to click on an item in a multi-column listbox and show the equivalent of a tooltip label if the text isn't fully displayed because the list box is not wide enough. How do you do this ? If you can't, please can you suggest an alternative.

Thanx.
0
Comment
Question by:timjc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 1471160
Put an invisible label on your form.

Then, in the MouseUp event you move your label to the X and Y coordinates the the event gives you and make your label visible.
0
 

Author Comment

by:timjc
ID: 1471161
How do I stop that label from being partially hidden by the form should it want to reach further to the right than the form is ?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 1471162
When you want to show the label, check that X + label.Width is less than form.scalewidth.

If not, you can move your label some twips to the left.

Maybe you can deal with autosize and wordwrap property of the label.
0
 
LVL 3

Expert Comment

by:jbil
ID: 1471163
Also you could use tooltips and change it's text

like this.........

Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ypos

ypos = Int(Y / (List1.FontSize * 25))
List1.ToolTipText = List1.List(ypos)

End Sub
0
 
LVL 4

Accepted Solution

by:
anzen earned 90 total points
ID: 1471164
Try this:

Create a new project, add a listbox to Form1 and call it
lstTest, next insert the following code in Form1:

Private Sub Form_Load()
    Dim iItem As Integer
   
    With lstTest
        For iItem = 0 To 1000
            .AddItem "Item #" & iItem
            .ItemData(.NewIndex) = Int((1000 - 101) * Rnd + 100)
        Next iItem
    End With
End Sub

Private Sub lstTest_Click()
    With lstTest
        If .ListIndex <> -1 Then
            .ToolTipText = .List(.ListIndex) & " (Value=" & .ItemData(.ListIndex) & ")"
        End If
    End With
End Sub

now, whenever You click an item on the list the tooltip will
be changed to reflect the data of the selected item

Byte

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

730 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