Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview Remove
Message
 
To
21/09/2000 17:09:11
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00419374
Message ID:
00419769
Views:
37
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)
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform