Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview Remove
Message
From
22/09/2000 12:13:08
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00419374
Message ID:
00419809
Views:
22
Roi,

Would this work also?

oParentNode = toNode.Parent

DO WHILE oParentNode.Children > 0

THIS.Nodes.REMOVE(oParentNode.Child.Index)

ENDDO

Dan


>Ok, I got it. Here's the code I came up with:
>
>
**=======================================================================
>** 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)
>
>
>>Try THISFORM.oTree.Nodes.REMOVE(iNodeIndex)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform