Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile Exe
#Dim All
%Unicode=1
#Include "Win32API.inc"
%IDC_TreeView = 100 : %IDC_Button = 200
Global hDlg As Dword
Function PBMain() As Long
Dialog Default Font "Tahoma", 48, 1
Dialog New Pixels, 0, "TreeView",,,600,550, %WS_SysMenu, 0 To hDlg
Control Add Treeview, hDlg, %IDC_TreeView, "", 10,10,580,530
LoadTreeView
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_Notify
Select Case Cb.NmId
Case %IDC_TreeView
Select Case Cb.NmCode
Case %NM_CustomDraw
Dialog Set Text hDlg, "CustomDraw " + Time$
Case %TVN_ItemExpanded 'Dialog Set Text hDlg, "Expand " + Time$
Case %TVN_SelChanged 'Dialog Set Text hDlg, "Selchanged " + Time$
End Select
End Select
End Select
End Function
Sub LoadTreeView
Local hItem, hTemp, hTemp2, hTemp3, hLst As Dword
Treeview Insert Item hDlg, %IDC_TreeView, 0, %TVI_Last, 0,0,"Root" To hItem
Treeview Insert Item hDlg, %IDC_TreeView, hItem, %TVI_Last, 0,0,"Mother" To hTemp
Treeview Insert Item hDlg, %IDC_TreeView, hTemp, %TVI_Last, 0,0,"Dan" To hTemp2
Treeview Insert Item hDlg, %IDC_TreeView, hTemp, %TVI_Last, 0,0,"Bob" To hTemp3
Treeview Set Expanded hDlg, %IDC_TreeView, hTemp, %True
Treeview Insert Item hDlg, %IDC_TreeView, hTemp3, %TVI_Last, 0,0,"Foot" To hTemp2
Treeview Insert Item hDlg, %IDC_TreeView, hTemp3, %TVI_Last, 0,0,"Arm" To hTemp2
Treeview Set Expanded hDlg, %IDC_TreeView, hTemp3, %True
Treeview Set Expanded hDlg, %IDC_TreeView, hItem, %True
ImageList New Icon 72,27,24,5 To hLst
Treeview Set ImageList hDlg, %IDC_TreeView, hLst
End Sub
'gbs_00262
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm