Este es un ejemplo básico
de como crear un treeview agregarle nodos, expandirlo y darle formato a un
nodo especifico
#Define
tvwFirst 0
#Define tvwLast 1
#Define tvwNext 2
#Define tvwPrevious 3
#Define tvwChild 4
oForm = Createobject('myForm')
oForm.Caption = "Ejemplo de Treeview"
With oForm
With .Tree
.Left = 10
.Top = 10
.Width = 300
.Height = 200
.Nodes.Add(,tvwFirst,"root0",'Main
node 0')
.Nodes.Add(,tvwFirst,"root1",'Main
node 1')
.Nodes.Add(,tvwFirst,"root2",'Main
node 2')
.Nodes.Add('root1',tvwChild,"child11",'Child11')
.Nodes.Add('root1',tvwChild,"child12",'Child12')
.Nodes.Add('root2',tvwChild,"child23",'Child23')
.Nodes.Add('child11',tvwChild,"child113",'child113')
With .Nodes.Add('child113',tvwPrevious,"child112",'child112')
.Bold=.T.
Endwith
With .Nodes.Add('child112',tvwPrevious,"child111",'child111')
.Bold = .T.
Endwith
With .Nodes.Add('child23',tvwPrevious,"child22",'Child22')
.Bold=.T.
Endwith
With .Nodes.Add('child22',tvwPrevious,"child21",'Child21')
.Bold=.T.
Endwith
For Each oNode In .Nodes
oNode.Expanded = .T.
Endfor
Endwith
.Show()
Endwith
Read Events
Define Class myForm As Form
Add Object Tree As OleControl
With ;
Name = 'Tree',OleClass='MSComCtlLib.TreeCtrl'
Procedure Init
With This.Tree
.linestyle = 1
.Font.Name = 'Tahoma'
.Font.Size = 10
.indentation = 5
Endwith
Endproc
Procedure QueryUnload
Clear
Events
Endproc
Enddefine