Hi, experts
I want to use TreeView dynamically. I did these steps (code below is simplified):
1. Built one TreeView (code in Form's Init) with 2 parents
This.List1.Nodes.Add(, 1, 'TX', 'Taxonomy', 0)
This.List1.Nodes.Add(, 1, 'ID', 'Identifiers', 0)
This.List1.Nodes.Add('TX', 4, 'Genus', 'Genus', 0)
This.List1.Nodes.Add('TX', 4, 'Species','Species',0)
This.List1.Nodes.Add('ID', 4, 'Genotype', 'Genotype', 0)
This.List1.Nodes.Add('ID', 4, 'Organ', 'Organ', 0)
This.List1.Nodes.Add('ID', 4, 'Treatment', 'Treatment', 0)
This.List1.Nodes.Add('ID', 4, 'Location', 'Location', 0)
This.List1.Nodes.Add('ID', 4, 'Unit', 'Hormone unit', 0)
This.List1.Nodes.Add('ID', 4, 'Date', 'Date', 0)
This.List1.Nodes.Add('ID', 4, 'Remarks', 'Remarks', 0)
2. I deleted all the Children belonging to ID parent.
For n = 1 To Thisform.List1.Nodes.Count
3. Recreated back the children for ID parent.
Thisform.List1.Nodes.Add('ID', 4, 'Genostrain', 'Genotype', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Organ', 'Organ', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Treatment', 'Treatment', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Location', 'Location', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Unit', 'Hormone unit', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Date', 'Date', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Remarks', 'Remarks', 0)
4. Displayed all the nodes
For n = 1 To Thisform.List1.Nodes.Count
And I don't see anymore the Children for ID node. I tried ThisForm.Refresh and ThisForm.List1.Refresh, but in vain. I checked the number of nodes and it is displayed correctly, showing that I really added the Children. Obviously, I miss something! Please, help! Thank you very much.
All the best,
Neculai
I want to use TreeView dynamically. I did these steps (code below is simplified):
1. Built one TreeView (code in Form's Init) with 2 parents
This.List1.Nodes.Add(, 1, 'TX', 'Taxonomy', 0)
This.List1.Nodes.Add(, 1, 'ID', 'Identifiers', 0)
This.List1.Nodes.Add('TX', 4, 'Genus', 'Genus', 0)
This.List1.Nodes.Add('TX', 4, 'Species','Species',0)
This.List1.Nodes.Add('ID', 4, 'Genotype', 'Genotype', 0)
This.List1.Nodes.Add('ID', 4, 'Organ', 'Organ', 0)
This.List1.Nodes.Add('ID', 4, 'Treatment', 'Treatment', 0)
This.List1.Nodes.Add('ID', 4, 'Location', 'Location', 0)
This.List1.Nodes.Add('ID', 4, 'Unit', 'Hormone unit', 0)
This.List1.Nodes.Add('ID', 4, 'Date', 'Date', 0)
This.List1.Nodes.Add('ID', 4, 'Remarks', 'Remarks', 0)
2. I deleted all the Children belonging to ID parent.
For n = 1 To Thisform.List1.Nodes.Count
If Substr(ThisForm.List1.Nodes.Item.FullPath, 1, 11) == 'Identifiers'
ThisForm.List1.Nodes.Remove
Endif
Next3. Recreated back the children for ID parent.
Thisform.List1.Nodes.Add('ID', 4, 'Genostrain', 'Genotype', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Organ', 'Organ', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Treatment', 'Treatment', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Location', 'Location', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Unit', 'Hormone unit', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Date', 'Date', 0)
Thisform.List1.Nodes.Add('ID', 4, 'Remarks', 'Remarks', 0)
4. Displayed all the nodes
For n = 1 To Thisform.List1.Nodes.Count
Wait Window ThisForm.List1.Nodes.Item.FullPath
NextAnd I don't see anymore the Children for ID node. I tried ThisForm.Refresh and ThisForm.List1.Refresh, but in vain. I checked the number of nodes and it is displayed correctly, showing that I really added the Children. Obviously, I miss something! Please, help! Thank you very much.
All the best,
Neculai