I’m having a problem iterating through my nodes. I’ve made a custom node with a textnode and a picture on top, and than added to the document. I’ve then put links between these nodes.
The way I’ve added the top node is:
Then I add children to this node or children nodes by doing this when I double-click on a node:
Now, I want to iterate through all the nodes under a specific node, I use:
For Each node In obj.GetEnumerator
Unfortunately it only iterates through the immediate children of that node, how do I iterate through all of them?
It’s fine, I figured out a recursive algorithm to do this.
It appears to me that your For Each loop would just be looking at the child objects of that node (a group). Here’s an example from the User Guide:
Selecting all the nodes directly connected to a node labeled “Rome”:
Dim obj As GoObject = aView.Document.FindNode(“Rome”)<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
If TypeOf obj Is CityNode Then
Dim rome As CityNode = CType(obj, CityNode)
For Each node In rome.Nodes
If TypeOf node.GoObject Is CityNode Then
End If Depending on the direction of links going to the desired nodes, you might want to use "rome.Destinations" or "rome.Sources" instead of "rome.Nodes" above, which iterates over all of the connected nodes regardless of link direction. And then you can extend this in the recursive manner you already seem to have figured out. There are more examples of this in the sample applications.