Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview Remove
Message
De
22/09/2000 12:13:08
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Divers
Thread ID:
00419374
Message ID:
00419809
Vues:
23
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform