myForm = VCL.Form("MyForm") myForm.Font._ = { name="Courier", size=11, } local myTree = VCL.Tree(myForm,"myTree") myTree._ = { align = "alClient", onclick="onTreeClick" } function onTreeClick() local i = myTree:Selected() print(i, myTree:Get(i),myTree:GetData(i)) end local myImgList = VCL.ImageList(myForm,"myImgList") local p,n = resource.getfile(medialib.."i1.bmp") myImgList:LoadBuffer(medialib.."i1.bmp",p,n,VCL.clWhite) p,n = resource.getfile(medialib.."i2.bmp") myImgList:LoadBuffer(medialib.."i2.bmp",p,n,VCL.clWhite) p,n = resource.getfile(medialib.."i3.bmp") myImgList:LoadBuffer(medialib.."i3.bmp",p,n,VCL.clWhite) myTree:Images(myImgList) local ti = { {text="hello",data=nil,image=1}, {text="world",data=123,image=2, {text="child1 of world", -- node3 {text="XXX", -- node4 {text="YYYY"} }, }, {text="child2 of world", data=myTree}, }, {text="thisisaluatree",image=3, {text="VVVV", -- node8 {text="WWWW"} } }, } myTree:Clear() myTree:SetItems(ti) myTree:Delete(8) p,n = resource.getfile(medialib.."i1.png") myImgList:LoadBuffer(medialib.."i1.png",p,n,VCL.clWhite) myTree:Add(3,"added to third node",nil,4,2)