Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where is my logic this morning?
Message
From
22/10/2003 10:42:51
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00841000
Message ID:
00841052
Views:
20
Thanks for look at this Neil, I'll look at your test example and give it a try...

>Tracy,
>
>You could try using recursion to populate the treeview. The code below processes the "root" nodes.
>
>LOCAL lnNode
>LOCAL lnRootTotal
>LOCAL loRootNode
>
>LOCAL ARRAY laRootNodes[1]
>
>
>select * from al3parnt ;
>	where cParent == "A0" ;
>	into array laRootNodes
>
>lnRootTotal = _tally
>
>for lnNode = 1 to lnRootTotal
>	loRootNode = ThisForm.oleTree.Nodes.Add(, 1, sys(2015), laRootNodes[lnNode, 2], 0, 0)
>	
>	loRootNode.Expanded = .T.
>	loRootNode.Tag = laSource[lnNode, 3]
>	
>	ThisForm.LoadSubNodes(loRootNode)
>endfor
>
>I could have found the root nodes in a number of ways, its not really important, what you should note is the call to the ThisForm::LoadSubNodes method listed below.
>
>LPARAMETERS loParentNode
>
>LOCAL lnSubTotal
>LOCAL lnSubNode
>LOCAL loSubNode
>
>LOCAL ARRAY laSubNodes[1]
>
>select * from al3parnt ;
>	where cParent == loParentNode.text ;
>	and seq == loParentNode.tag ;
>	into array laSubNodes
>
>lnSubTotal = _tally
>
>if _tally > 0	
>	for lnSubNode = 1 to lnSubTotal
>		loSubNode = ThisForm.oleTree.Nodes.Add(loParentNode, 4, sys(2015), laSubNodes[lnSubNode, 2], 0, 0)
>
>		loSubNode.Expanded = .T.
>		loSubNode.Tag = laSubNodes[lnSubNode, 3]
>				
>		ThisForm.LoadSubNodes(loSubNode)
>	endfor
>endif
>
>As you can see, this method calls itself recursively until it bottoms out. I have taken some shortcuts to keep the example simple, you probably wouldn't use _tally or sys(2015) and you would want to put a check in to test the ceiling on the recursion level which I believe is 128.
>
>HTH
>Neil
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Reply
Map
View

Click here to load this message in the networking platform