Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nodes order in treeview
Message
 
À
15/10/2000 02:31:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00428492
Message ID:
00429672
Vues:
12
Try this, it will work with any three tier treeview.Include form name and tree view name are part of the with statement.
You can run it as prg while the form is running (providing your form is modeless), or paste it into a method and call it from control event.
HOW do you guys get the indents. Mine always line with left margin. How do I set the tab stops for my UT reply editor?

* Here's a cursor to stash the results in
Create cursor tmp_tv (nodetext c(30))
Select tmp_tv

* Now assure a start at first root node
With MyForm.MyTreeView && Use your form name and trreview name here
If vartype(.selecteditem.parent)#[O] && Is this a root node
lnFirstRootIndex=.selecteditem.firstsibling.index
Else
If vartype(.selecteditem.parent.parent)#[O] && Is this parent a root
lnFirstRootIndex=.selecteditem.parent.firstsibling.index
Else && The parent's parent is a root node
lnFirstRootIndex=.selecteditem.parent.parent.firstsibling.index
Endif &&The parent's parent is a root node// vartype(.selecteditem.parent.parent)#[O]
Endif &&vartype(.selecteditem.parent)#[O] && Is this a root node
oCurRoot=.Nodes(lnFirstRootIndex)
Do while .t. && Loop through root nodes
Append blank
Repl nodetext with oCurRoot.Text && Update for root node
If oCurRoot.Children>0 && Root Node has child nodes
oCurChild=oCurRoot.child
Do while .t. && Loop through child nodes
Append blank
Repl nodetext with oCurChild.Text && Update for Child node
* Work the grand children
If oCurChild.Children>0 && Child node as grand children
oCurGrandChild=oCurChild.child
Do while .t. && Loop through grand children
Append blank
Repl nodetext with oCurGrandChild.Text && Update for first grand Child node
lcCommand=iif(vartype(oCurGrandChild.next)=[O],[oCurGrandChild=oCurGrandChild.next],[exit])
&lcCommand
Enddo && Loop Grand childrenn
Endif &&oCurChild.Children>0 && Child node as grand children
lcCommand=iif(vartype(oCurChild.next)=[O],[oCurChild=oCurChild.next],[exit])
&lcCommand
Enddo && Loop Children
Endif &&oCurRoot.Children>0
lcCommand=iif(vartype(oCurRoot.next)=[O],[oCurRoot=oCurRoot.next],[exit])
&lcCommand
Enddo && Loop Root
Endwith
Browse &&TMP_TV
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform