Date: 02-16-2022
Return to Index
created by gbSnippets
'By default, a ListView shows InfoTips - the entire text of an item 0,
'if that text has been truncated.
'Primary Code:
ListView Set StyleXX hDlg, %IDC_ListView, %LVS_Ex_InfoTip '<--- enables builtin tooltips
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
#Include "commctrl.inc"
#Resource "gbsnippets.pbr"
%IDC_ListView = 500
Global hDlg,hTooltip,hListView,hList As Dword, iResult As Long
Function PBMain() As Long
Dialog New Pixels, 0, "ListView Test",300,300,200,125,%WS_SysMenu, 0 To hDlg
CreateListView
Dialog Show Modal hDlg
End Function
Sub CreateListview
Control Add ListView, hDlg, %IDC_ListView, "", 10,10,180,100, %WS_Visible Or %LVS_Icon
' ListView Set StyleXX hDlg, %IDC_ListView, %LVS_Ex_InfoTip '<--- enables builtin tooltips
Control Handle hDlg, %IDC_ListView To hListView
ImageList New Icon 32,32,24,3 To hList
ImageList Add Icon hList, "x" 'image 1
ImageList Add Icon hList, "y" 'image 2
ListView Set ImageList hDlg, %IDC_ListView, hList, %lvsil_normal 'normal (large) imagelist for LVS_Icon mode
ListView Insert Column hDlg, %IDC_ListView, 1, "test1", 75, 0
ListView Insert Item hDlg, %IDC_ListView, 1, 1, "oneandtwo" 'row 1, col1 '<-- not truncated, no InfoTip
ListView Insert Item hDlg, %IDC_ListView, 2, 2, "two and three and four and five and size" '<-- truncated, so InfoTip is shown
End Sub
'gbs_00990
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm