TreeGadget (lost images) now with better source code
Posted: Wed Jul 02, 2003 3:59 pm
This is doing my head in and I can't figure out why, but in one program these functions work, they add the icon to the the aproperate label in the tree, when I copyed them out into another it doesn't add the images anymore and doesn't even add a space next to the label to show one should have been there..
Any help would be greatly recived thank you.
Code: Select all
;
; loads icons in ( wish these could be .ico but never mind )
;
Procedure Load_DisplayEntryIcons()
htvicons=LoadImage(4000,"bitmaps/treeviewicons.bmp")
htvmask=LoadImage(4001,"bitmaps/treeviewmask.bmp")
tvdb_hImgList=ImageList_Create_(16,16,#ILC_COLOR8|#ILC_MASK, 2, 4)
Debug("ILA-"+Str(ImageList_Add_(tvdb_hImgList,htvicons,htvmask)))
EndProcedure
;
; adds label to treeview.
;
Procedure.l AddFolderItemTree(gadget.l,foldername.s,nLevel.l)
gadget=GadgetID(gadget)
tvi.TVITEM
tvins.TVINSERTSTRUCT
hPrev=#TVI_FIRST
If nLevel=0 : ProcedureReturn 0 : EndIf
tvins\item\mask=#TVIF_TEXT|#TVIF_IMAGE
tvins\item\pszText = @foldername
tvins\item\cchTextMax = Len(foldername)
tvins\item\iImage = 0
If nLevel=1
tvins\hParent=#TVI_ROOT
hPrev=SendMessage_(gadget,#TVM_INSERTITEM,0,@tvins)
Else
tvins\hParent=hPrevItemArray(nLevel-1)
hPrev=SendMessage_(gadget,#TVM_INSERTITEM,0,@tvins)
EndIf
hPrevItemArray(nLevel)=hPrev
ProcedureReturn hPrev
EndProcedure