Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview Remove
Message
From
22/09/2000 12:27:40
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00419374
Message ID:
00419822
Views:
26
>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,
Another idea :
	DO WHILE oParentNode.children > 1
		thisform.Oletreeview.Nodes.Remove(oParentNode.Child.Index)
	ENDDO
Or starting to remove from lastsibling with step -1 ?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform