**======================================================================= >** Removes all the siblings of the passed node. > >LPARAMETERS toNode > >LOCAL oParentNode, iNodeIndex, oLastNode > >** Grab the parent node, and the last sibling >oParentNode = toNode.PARENT >oLastNode = toNode.LastSibling >iNodeIndex = oLastNode.INDEX > >IF oParentNode.children > 1 > > iNodeIndex = toNode.FirstSibling.INDEX > > ** Loop through all the siblings and remove them. > ** then indexes may change so we always need to get a new > ** reference to the LastSibling. This loop leaves the > ** last sibling. > DO WHILE oParentNode.children > 1 > > THIS.Nodes.REMOVE(iNodeIndex) > iNodeIndex = oLastNode.FirstSibling.INDEX > oLastNode = oLastNode.LastSibling > > ENDDO > >ENDIF > >** Only the last is left, so whack it. >THIS.Nodes.REMOVE(iNodeIndex) >>
DO WHILE oParentNode.children > 1 thisform.Oletreeview.Nodes.Remove(oParentNode.Child.Index) ENDDOOr starting to remove from lastsibling with step -1 ?