#define tvwFirst 0 #define tvwLast 1 #define tvwNext 2 #define tvwPrevious 3 #define tvwChild 4 create cursor myTree (nodeId c(10), parentID c(10), nodeText c(50)) insert into myTree values ( "root1", "", "This is root#1") insert into myTree values ( "root2", "", "This is root#2") insert into myTree values ( "root3", "", "This is root#3") insert into myTree values ( "r1c1","root1", "This is child 1 of root#1") insert into myTree values ( "r1c2","root1", "This is child 2 of root#1") insert into myTree values ( "r1c3","root1", "This is child 3 of root#1") insert into myTree values ( "r2c1","root2", "This is child 1 of root#2") insert into myTree values ( "r1c2c1","r1c2","This is child 1 of root#1-child1") public oForm oForm = createobject('myForm') with oForm with .Tree scan if empty(parentID) .Nodes.add(,tvwFirst,trim(nodeID),nodeText) else .Nodes.add(trim(parentID),tvwChild,trim(nodeID),nodeText) endif endscan endwith .show() endwith define class myForm as form Height = 200 Width = 400 add object Tree as olecontrol with ; name = 'Tree',oleclass='MSComCtlLib.TreeCtrl' procedure init with this.tree .linestyle = 1 .font.name = 'Times New Roman' .font.size = 10 .indentation = 5 .Height = 200 .Width = 400 endwith endproc procedure Tree.NodeClick lparameters oNode wait window 'Node clicked '+oNode.Key timeout 3 endproc enddefineCetin