The TreeView Insert Item code lines below are supposed to prevent images from showing alongside the TreeView data items. Despite using the 0 image value, to indicate no image, my code still shows icons.
Has anyone else had this problem?
By experimenting, I noticed that it's always the first icon in the imagelist - as though the 0 is used for the first image, rather than 1, as is stated in the Help file.
I tried -1 and 999 (arbitrarily large). -1 still shows an image. 999 does not show an image, but leaves a gap where an image would be is #999 existed.
If I completely remove the imagelist, then no images are shown. But I'm looking to pick and choose which items get images. Athough, it appears that if any item has an image, even those without will have a gap displayed where the image would have gone. Not as clean looking as I wanted.
The pbr file is http://www.garybeene.com/files/pb-test.pbr is you need it.
Has anyone else had this problem?
By experimenting, I noticed that it's always the first icon in the imagelist - as though the 0 is used for the first image, rather than 1, as is stated in the Help file.
I tried -1 and 999 (arbitrarily large). -1 still shows an image. 999 does not show an image, but leaves a gap where an image would be is #999 existed.
If I completely remove the imagelist, then no images are shown. But I'm looking to pick and choose which items get images. Athough, it appears that if any item has an image, even those without will have a gap displayed where the image would have gone. Not as clean looking as I wanted.
The pbr file is http://www.garybeene.com/files/pb-test.pbr is you need it.
Code:
#Compile Exe #Include "win32api.inc" #Include "commctrl.inc" #Resource "pb-test.pbr" Global hDlg As Dword, hLst As Dword, hItem As Dword, hTemp As Dword Function PBMain() As Long Dialog New Pixels, 0, "TreeView Test",200,200,200,250, _ %WS_OverlappedWindow, 0 To hDlg 'create control Control Add Treeview, hDlg, 100, "", 10,10,175,225 '225 'create imagelist w,h,depth,size ImageList New Icon 16,16,32,3 To hLst ImageList Add Icon hLst, "x" ImageList Add Icon hLst, "y" ImageList Add Icon hLst, "z" 'attach imagelist Treeview Set ImageList hdlg, 100, hLst ' %TVI_FIRST %TVI_LAST %TVI_SORT 'add items hdlg, id&, hPrnt, hIAftr, image&, selimage&, txt$ to hItem Treeview Insert Item hDlg, 100, 0, %TVI_Last, 0,0,"One" To hItem Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 0,0,"One-1" To hTemp Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 0,0,"One-2" To hTemp Treeview Insert Item hDlg, 100, 0, %TVI_Last, 0,0,"Two" To hItem Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 0,0,"Two-1" To hTemp Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 0,0,"Two-2" To hTemp Treeview Insert Item hDlg, 100, 0, %TVI_Last, 0,0,"Three" To hItem Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 0,0,"Three-1" To hTemp Treeview Insert Item hDlg, 100, hItem, %TVI_Last, 0,0,"Three-2" To hTemp Dialog Show Modal hDlg Call DlgProc End Function CallBack Function DlgProc() As Long If Cb.Msg = %WM_Notify And Cb.NmId = 100 And _ Cb.NmCode = %TVN_SelChanged Then MsgBox "Selected!" End If
Comment