>nodeptr = thisform.oletreeview.selecteditem > >local childnodeptr >childnodeptr = m.nodeptr.child > >select ckey from treeview into cursor csrtemp where alltrim(ckey)==nodeptr.key >use (dbf([csrtemp])) again in 0 alias csrtable >select csrtable >use in csrtemp > >do while !isnull(m.childnodeptr) > append blank > replace ckey with m.childnodeptr.key > childnodeptr = m.childnodeptr.next >enddo >>
Process the node Process each Child Node from left to right in preorderUntested code below
&& recursive NodePtr = thisform.oletreeview.selecteditem =Cursor_Fill(NodePtr) ... function Cursor_Fill(NodePtr) && Depth first local Success Success = TRUE local ChildNodePtr do case case isnull(m.NodePtr) otherwise append blank replace ckey with m.NodePtr.Key ChildNodePtr = m.NodePtr.Child do while m.Success and !IsNull(m.ChildNodePtr) do case case !Cursor_Fill(m.ChildNodePtr) assert FALSE Success = FALSE otherwise ChildNodePtr = m.ChildNodePtr.next endcase enddo endcase return m.Success endfunc