VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Adding multiline balloon tooltips to ListView items

by 10Tec Company (5 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (19 Votes)

The attached code demonstrates a technique you can use to create multiline balloon tooltips for ListView items.
The code is based on the following simple idea. In the MouseMove event you need to check the index of the item under the mouse pointer, and if this item is changed, you simply redefine the text of the tooltip attached to the ListView control. Notice that you should destroy the tooltip if there is no any item under the mouse pointer.
To determine the index of the list-view item under the mouse pointer, we send the LVM_HITTEST message to the ListView control. The SendMessage function you should use to send this message returns the index of the item at the specified position, if any, or -1 otherwise. Before you send the message, populate the pt field of an instance of the LVHITTESTINFO structure with the coordinates of the mouse pointer (you pass the reference to this structure as the value of the lParam parameter in SendMessage). You can use for this purpose the X and Y parameters of the MouseMove event of the control, but draw attention at the fact that these parameters can be measured in twips and you need to convert them in pixels.
This simple idea can be used to create such tooltips for ListBox items, any grid control items and so on. For instance, we use this technique in extra samples for iGrid ActiveX Control we produce (this is an editable replacement for ListView and FlexGrid – visit www.10Tec.com for more info).

Rate Adding multiline balloon tooltips to ListView items

Download Adding multiline balloon tooltips to ListView items

Download Adding multiline balloon tooltips to ListView items (5 KB)

Adding multiline balloon tooltips to ListView items Comments

No comments have been posted about Adding multiline balloon tooltips to ListView items. Why not be the first to post a comment about Adding multiline balloon tooltips to ListView items.

Post your comment

Subject:
Message:
0/1000 characters