Solved

Tool tips equivalent

Posted on 1999-01-29
5
214 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 30 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

738 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