General information
Category:
ActiveX controls in VFP
>
>Joseph,
>
>First of all, thanks for your help. Just to clarify, should the line:
>
>
>
>For l_n = l_nChildIndex + (l_nChildIndex+l_nChildren-1)
>
>
>
>be
>
>
>
>For l_n = l_nChildIndex TO (l_nChildIndex+l_nChildren-1)
>
>
>
>I tried your code. It was pretty close to what I
>already have, but it still is not quite there.
>
>The code you provided does the same thing mine does; it
>loops through each node, then ITS child nodes, and continues
>to drill down THAT tree.
>
>The problem may also be that I recursively loaded the treeview
>from a directory structure, so the index values at any given
>level are not sequential.
>
>The best illustration I can think of would be Explorer.
>If you expand the 'C:' node, you see all the root level
>folders.
>
>How would I loop through all the root level 'folder' nodes,
>not the subfolders under them?
>
>Many thanks!
>
>
Kevin,
Yes, the line should have been
For l_n = l_nChildIndex To (l_nChildIndex+l_nChildren-1)
<< Can anybody tell me why the text becomes left aligned when previewing? >>
How about the following...
With This
l_o = .Nodes(1)
l_nLastSibling = l_o.LastSibling.Index
Do While .T.
.displaychildren(l_o)
If l_o.Index = l_nLastSibling
Exit
Else
l_o = .Nodes(l_o.next.index)
EndIf
EndDo
EndWith
Procedure displaychildren
Lparameters p_oNode
Local l_n, l_nChildren, l_nChildIndex, l_o
With This
*-- p_oNode is the parent node your interested in --*
l_nChildren = p_oNode.Children
If l_nChildren > 0
l_nChildIndex = p_oNode.Child.Index
For l_n = 1 To l_nChildren
l_o = .Nodes(l_nChildIndex)
Wait Window "Parent Key: " + p_oNode.key + "Child Key: " + l_o.Key
If !(l_nChildIndex = p_oNode.Child.LastSibling.Index)
l_nChildIndex = .Nodes(l_nChildIndex).Next.Index
EndIf
EndFor
EndIf
EndWith
Return
*-- eop displaychildren
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only