Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
%Unicode=1
#Resource Icon xgray "x.ico"
#Resource Icon xblue "type.ico"
#Include "win32api.inc"
Global hDlg, hTreeView, hLst, hItem, hTemp As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "TreeView",200,200,155,200, %WS_SysMenu, 0 To hDlg
Control Add Button, hDlg, 500, "Change Icon", 10,10,75,25
'create treevie
Control Add Treeview, hDlg, 100, "", 10,70,130,120
Control Handle hDlg, 100 To hTreeView
ImageList New Icon 16,16,32,3 To hLst
ImageList Add Icon hLst, "xgray"
ImageList Add Icon hLst, "xblue"
Treeview Set ImageList hDlg, 100, hLst
Treeview Insert Item hDlg, 100, 0, %TVI_Last, 1,1,"One" To hItem
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local TreeViewItem As TVItemEX, hNode As Dword
Static IconChoice As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case 500
IconChoice Xor= 1 'toggle between icon 0 and 1
Treeview Get Root hDlg, 100 To hNode
TreeView_GetItemEX hTreeView, TreeViewItem
TreeViewItem.mask = %TVIF_Image
TreeviewItem.hItem = hNode
TreeViewItem.iImage = IconChoice
TreeView_SetItemEX hTreeView, TreeViewItem
End Select
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm