I have a two Ultratree controls...the first tree control is on a form that is restricted in height and width. So I have a popup component that floats over the form and the height and width is much bigger to all the user to see more detail of the data. The goal is that when I select a node from the popup form is that it is transfered back to the original form. I have an event that passes back the selectednodes collection. I was trying to loop through the orignal tree and have not been able to find anything on how I would programically select the original tree with the same selection from the popup tree.
Thanks for any help on this
Public Sub SetSelectedNode(ByVal selectedNodes As SelectedNodesCollection)
For Each node As UltraWinTree.UltraTreeNode In selectedNodes
If node.Selected Then
For Each treenode As UltraWinTree.UltraTreeNode In ResultsTree.Nodes
If node.FullPath = treenode.FullPath Then 'NOTE problem with this is some node paths with the same name.
'ResultsTree.ActiveNode.Selected = True 'NOTE Doesn't work
'ResultsTree.Nodes.Item(treenode.Key).Selected = True 'NOTE not sure this work plus I don't have the key set and dont know how.
End If
Next
End Sub
UltraTreeNode exposes an Expanded property and an ExpandAll method. The former expands only that node, where the latter expands it and all descendants.
One more question...How do you make the node expand?...I will keep working on this too...
Thanks,
Richard
I have been testing this and it works fine when the Rootnode is selected. I doesn't work when a child node is selected. How can I programically select a child node of the Result tree. Any ideas?
Thank you for your response...
It did finally work...I reworked my solution below
For Each node As UltraWinTree.UltraTreeNode In selectedNodes If node.Selected Then ResultsTree.Nodes.Item(node.Index).Selected = True Next
rrober07 said:'ResultsTree.ActiveNode.Selected = True 'NOTE Doesn't work
What exactly is not working? Is the Selected property not return true after you set it?
My guess is that your code is working fine, but you just don't see the selected nodes in the tree because the tree does not have focus. Try setting HideSelection on the tree to false or activating the tree control so that you can see the selection.