Results 1 to 6 of 6

Thread: tooltip for list items?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    tooltip for list items?

    how can I set a tooltip for each item in a listbox control?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I don't think so but you can change the one for the list dynamically with each item selected.

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Edneeis
    I don't think so but you can change the one for the list dynamically with each item selected.
    hmm weirdness I thought it was easy
    well I want to have it whenever the mouse hovers over an item. I guess I have to show the tooltip manually, kinda inefficient I guess
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Lively Member
    Join Date
    Oct 2003
    Posts
    88
    I didn't think it was especially tricky... This is a bit more than you seem to be asking for (I pull my tip strings from a dataset for the app I cut this from) but the principle would be the same for whatever method you want to store your tip text:

    VB Code:
    1. Private Sub lvwItems_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    2.     Handles lvwItems.SelectedIndexChanged
    3.         SetToolTip()
    4.     End Sub
    5.  
    6.     Private Sub SetToolTip()
    7.         If lvwItems.SelectedItems.Count > 0 Then
    8.             'Go get whole record for selected item
    9.             Dim strTip As String
    10.             Dim objRow As DataRow = dsData.Tables("SomeTable").Rows.Find(lvwItems.SelectedItems(0).Text)
    11.             strTip = lvwItems.SelectedItems(0).Text
    12.             If objRow("Comment") <> "" Then
    13.                 strTip += ControlChars.CrLf + "Comment: " + objRow("Comment")
    14.             End If
    15.             tipMain.SetToolTip(lvwItems, strTip)
    16.         End If
    17.     End Sub

    I guess if you wanted to get more fancy you could set an event handler for MouseHover and see what's under the mouse? This was good enough for me though.

  5. #5
    Lively Member
    Join Date
    Oct 2003
    Posts
    88
    also since ToolTip.SetToolTip expects a control as an input, and ListViewItem is not a control, I don't believe you can set separate tooltips for each listview item, as Edneeis says you probably have to set it for each item you are looking at.

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    well I've seen it done in programs, so it can be done

    I'm a lil busy... I have to find some free time and see if I can do it for each list item or not
    thanks for the replies
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

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