LPARAMETERS tlNo1stNode > > >* constants used in treeview NODES.ADD method >#DEFINE tvwFirst 0 >#DEFINE tvwLast 1 >#DEFINE tvwNext 2 >#DEFINE tvwPrevious 3 >#DEFINE tvwChild 4 > > >LOCAL llCheckExpanded, laExpanded[1], lo, loNode, loNode1, lcVN, lcID, lcPID, lcText, lcOrder > > >THISFORM.LOCKSCREEN = .T. > > >* If there are any items already in the tree, save the expanded status >* of each one. >llCheckExpanded = THIS.oleTreeView.Nodes.COUNT > 0 > >IF llCheckExpanded > THIS.GetExpanded(@laExpanded) >ENDIF > > >* while the Remove method removes a single node >* the Clear method removes all nodes from the treeview >THIS.oleTreeView.Nodes.CLEAR() > > >lo = THIS.oleTreeView > > > >THIS.oDEManage.PUSH() > >lcVN = THIS.cViewName >lcID = THIS.cID >lcPID = THIS.cParentID >lcText = THIS.cText >lcOrder = THIS.cOrder > >SELECT "R" + STR(&lcID.) AS iID, &lcText. AS cName ; > FROM (THIS.cDBCName + "!" + lcVN) ; > WHERE !DELETED() AND EMPTY(&lcPID.) ; > ORDER BY &lcOrder. ; > INTO CURSOR tQuery > >SELECT tQuery >LOCATE > >SCAN > loNode = THIS.AddOneNode(tQuery.iID, ALLTRIM(tQuery.cName)) > > > * Load the orders for this customer if necessary. > THIS.AddChildren(tQuery.iID, loNode) >ENDSCAN > >USE IN tQuery > >THIS.oDEManage.POP() > > >* If there were any items already in the tree, set the expanded status >* of each one. >IF llCheckExpanded > THIS.SetExpanded(@laExpanded) >ENDIF > >THISFORM.LOCKSCREEN = .F. > >WAIT CLEAR > > >IF !tlNo1stNode > * sets the selected node to the first one in the collection > lo.SELECTEDITEM = lo.Nodes(1) > > THIS.UpdateFromTreeView(lo.SELECTEDITEM) >ENDIF >>
LPARAMETERS taExpanded > >LOCAL lnI, lnNode > >WITH THIS.oleTreeView > FOR lnI = 1 TO .Nodes.COUNT > lnNode = ASCAN(taExpanded, .Nodes[lnI].FULLPATH) > > IF lnNode > 0 > lnNode = ASUBSCRIPT(taExpanded, lnNode, 1) > > IF taExpanded[lnNode, 2] > .Nodes[lnI].Expanded = .T. > ENDIF > ENDIF > NEXT >ENDWITH >>
LPARAMETERS taExpanded > >LOCAL lnI > >WITH THIS.oleTreeView > DIMENSION taExpanded[.Nodes.Count, 2] > > FOR lnI = 1 TO .Nodes.COUNT > taExpanded[lnI, 1] = .Nodes[lnI].FULLPATH > taExpanded[lnI, 2] = .Nodes[lnI].Expanded > NEXT >ENDWITH >