I got it to work (that is conceptually, more at end of message). Here is the code I used for anyone that is interested:
local iLoop, o, oNode
o = THISFORM.TreeView
*get the first sibling
oNode = o.Nodes[1].FirstSibling
iLoop = 1
messagebox('First Sibling: '+str(iLoop)+' '+oNode.text)
*if children then call TraverseChildren
if oNode.children > 0 then
=ThisForm.TraverseChildren(oNode.child, @iLoop)
endif
*loop thru the rest of the nodes on this level
do while not isnull(oNode.next)
iLoop = iLoop + 1
oNode = oNode.next
messagebox('Next: '+str(iLoop)+' '+oNode.text)
*if children then call TraverseChildren
if oNode.children > 0 then
=ThisForm.TraverseChildren(oNode.child, @iLoop)
endif
enddo
*TraverseChildren is a method for the form
parameters oNodeChild, nSeqNo
nSeqNo = nSeqNo + 1
messagebox('Child: '+str(nSeqNo)+' '+oNodechild.text)
*if children then call TraverseChildren
if oNodeChild.children > 0 then
=ThisForm.TraverseChildren(oNodeChild.child, @nSeqNo)
endif
* loop thru the children
do while not isnull(oNodeChild.next)
oNodechild = oNodechild.next
nSeqNo = nSeqNo + 1
messagebox('Child: '+str(nSeqNo)+' '+oNodechild.text)
*if children then call TraverseChildren
if oNodeChild.children > 0 then
=ThisForm.TraverseChildren(oNodeChild.child, @nSeqNo)
endif
enddo
My problem now is that the 2nd time that I traverse thry the treeview I get exception c0000005 and vfp craps out. I am using VFP5 with the SP3 for it installed and the TreeView control that came with that service pack.
Any suggestions on this error?
Derek Agar
Acctware Business Systems
derekagar@acctware.comICQ: 42332100
***********************
When in trouble call 911
He that dwelleth in the secret place
of the most High shall abide under
the shadow of the Almighty.
Psalm 91:1
***********************