#Define tvwFirst 0
#Define tvwLast 1
#Define tvwNext 2
#Define tvwPrevious 3
#Define tvwChild 4
CREATE CURSOR myForms (nodeID i, parentID i, nodeText c(20),formName c(10))
INSERT INTO myForms VALUES (1,0,"Root 1","")
INSERT INTO myForms VALUES (2,0,"Root 2","")
INSERT INTO myForms VALUES (4,1,"Root 1-C1","myForm1")
INSERT INTO myForms VALUES (5,1,"Root 1-C2","myForm2")
INSERT INTO myForms VALUES (6,1,"Root 1-C3","myForm3")
INSERT INTO myForms VALUES (7,2,"Root 2-C1","myForm21")
INSERT INTO myForms VALUES (8,2,"Root 2-C2","myForm22")
INSERT INTO myForms VALUES (9,2,"Root 2-C3","myForm23")
Public oForm
oForm = Createobject('myForm')
oForm.Show()
With oForm.Tree
.Left = 10
.Top = 10
.Width = 200
.Height = 200
SELECT myForms
SCAN
IF parentID = 0
.Nodes.Add(,tvwFirst,PADL(nodeID,3,'_'),NodeText)
ELSE
.Nodes.Add(PADL(parentID,3,'_'),tvwChild,PADL(nodeID,3,'_'),NodeText)
ENDIF
endscan
Endwith
Define Class myForm As Form
oNode= .Null.
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
Endwith
ENDPROC
PROCEDURE Tree.NodeClick(oNode)
SELECT myForms
LOCATE FOR nodeID = VAL(chrtran(oNode.Key,'_',''))
IF !EMPTY(myForms.FormName)
IF FILE( FORCEEXT(myForms.FormName,'scx') )
DO FORM (myForms.FormName)
ELSE
MESSAGEBOX( FORCEEXT(myForms.FormName,'scx') + " is missing." )
ENDIF
endif
endproc
Enddefine
Cetin
>hi,
>i try as under , but how i can run it at node or child i can choices
>
>PROCEDURE click
> With This.tree
> .DO FORM myform
> Endwith
> Endproc
>
>>I didn't say with .Nodes.Click
>>NodeClick is an event of treeview.
>>Cetin
>>
>>>hi,
>>>thank you very much,
>>>about do form,
>>>main
>>>WITH .Nodes.click(do form myform)&& not work
>>>