Children Property
Posted: Mon Feb 27, 2012 5:42 pm
Hello folks,
I'm trying to use TeeTree as a Flowchart manager, but, for some validation purposes, I need to know and use the Children property.
Some problems I experience and am still having trouble:
1 - TTreeNodeShape class has 2 misleading properties: Children and Childs. I've found no clue if both link to the same values or if one is preferable over another.
2 - The Parent property is updated automatically, but Childs/Children are not. When one inserts two nodes A and B in a TTree and creates a link from A to B, one can verify that A is in B.Parents list, but B is not in A.Children. In a global aspect, A.Children is always empty.
3 - I need to know information about the children of one node, and I'd rather not navigate through every connection to find out the children of one node. So I made some hardcode to manually insert the child in the Children list of a node. Whenever a new connection is made, lets say from A to B, I insert B manually in the Children list of A, using "A.Children.Add(B)".
4 - Now the big problem. When I try to delete a connected node, I get an "Invalid Pointer Operation" error. If I don't manually add nodes in the Children list, no problem is found. But if I insert the children, I get errors everytime I try to delete some node.
I suppose I'm doing something wrong in my logic, but can't seem to find the errors in it. I hope someone can help me and tell me if I'm using any wrong methods or an alternative, and hopefully easy, way of finding informations about children nodes (the navigate through connection solution is on my mind, but I'd rather not do it. It's quite ugly...)
I'm using Delphi XE and the latest version of TTree at the moment.
Kind regards,
I'm trying to use TeeTree as a Flowchart manager, but, for some validation purposes, I need to know and use the Children property.
Some problems I experience and am still having trouble:
1 - TTreeNodeShape class has 2 misleading properties: Children and Childs. I've found no clue if both link to the same values or if one is preferable over another.
2 - The Parent property is updated automatically, but Childs/Children are not. When one inserts two nodes A and B in a TTree and creates a link from A to B, one can verify that A is in B.Parents list, but B is not in A.Children. In a global aspect, A.Children is always empty.
3 - I need to know information about the children of one node, and I'd rather not navigate through every connection to find out the children of one node. So I made some hardcode to manually insert the child in the Children list of a node. Whenever a new connection is made, lets say from A to B, I insert B manually in the Children list of A, using "A.Children.Add(B)".
4 - Now the big problem. When I try to delete a connected node, I get an "Invalid Pointer Operation" error. If I don't manually add nodes in the Children list, no problem is found. But if I insert the children, I get errors everytime I try to delete some node.
I suppose I'm doing something wrong in my logic, but can't seem to find the errors in it. I hope someone can help me and tell me if I'm using any wrong methods or an alternative, and hopefully easy, way of finding informations about children nodes (the navigate through connection solution is on my mind, but I'd rather not do it. It's quite ugly...)
I'm using Delphi XE and the latest version of TTree at the moment.
Kind regards,