Jump to content

~ Tooltip For Long Items' Labels In ListView? (SOLVED)

Recommended Posts

I have a list view with long items' labels and I need to view a tool tip showing the full item label when the mouse cursor is over the Explorer-Styled item:

Any help please?

#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 275, 243, 192, 124)
$ListView1 = GUICtrlCreateListView("one|two", 8, 8, 257, 225)
_SetWindowTheme(GUICtrlGetHandle(-1), "Explorer")
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
$ListView1_0 = GUICtrlCreateListViewItem("item 1|item1-1", $ListView1)
$ListView1_1 = GUICtrlCreateListViewItem("item2|item2-2", $ListView1)
$ListView1_2 = GUICtrlCreateListViewItem("item item item 3|item item item 3-3", $ListView1)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg


Func _SetWindowTheme($hWnd, $sName = 0, $sList = 0)
Local $TypeOfName = 'wstr', $TypeOfList = 'wstr'
If Not IsString($sName) Then
$TypeOfName = 'ptr'
$sName = 0
If Not IsString($sList) Then
$TypeOfList = 'ptr'
$sList = 0
Local $Ret = DllCall('uxtheme.dll', 'uint', 'SetWindowTheme', 'hwnd', $hWnd, $TypeOfName, $sName, $TypeOfList, $sList)
If @error Then
Return SetError(1, 0, 0)
If $Ret[0] Then
Return SetError(1, $Ret[0], 0)
Return 1
EndFunc ;==>CtrlSetTheme

Thank you.

Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

Link to post
Share on other sites

I have an application that has a lot more information in some sub-items of the list view.

Even "$LVS_EX_INFOTIP" didn't cut it for me since it doesn't include line breaks or doesn't wrap.

What I've had to do was catch a few Widows Messages and display a custom infotip for them that

will wrap the string and include line breaks. I still don't like this method since it's pretty tricky to remove

the current infotip when the mouse leaves the gui, I can't figure out how to do it without using a mouse hook

or windows hook, which I'd like to avoid... :(

And adlib doesn't work either since the app is pretty busy doing things at times, which is why I'd like to solve

this using a windows message method. Still trying it though, and if I have something, I'll post it here. One of the problems is that the windows

messages like mouse events don't work with the listview.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...