Version 15.1.20151.2230 of UltraWinTree, VB2012:
With selection mode Extended, if I manually select a node, then use code to add a new node and select it, subsequent manual range selection malfunctions as if the original node is still selected.
Here is the entire code. Click node "ABC". Click "Button1", which adds node "WWW" and selects it and makes it active. Now hold shift and click node "JKL". Instead of selecting the range "WWW" to "JKL", it selects "DEF" to "JKL", as if the original node was still selected. Tried everything I could think of but can't fix this behavior:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
.HideSelection = False
.Override.SelectionType = SelectType.Extended
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lnodNew As UltraTreeNode = .Nodes.Add(999, "WWW")
lnodNew.Selected = True
.ActiveNode = lnodNew
I have been investigating into this issue, and it appears that the reason that the selection is not working correctly is because the "pivot" item of the UltraTree is not being set when you programmatically change the selection in your tree. In order to change this "pivot" item, I would recommend casting your UltraTree to an ISelectionManager and calling the SetPivotItem to your desired tree node. For example, you could use the following code at the end of your Button click to achieve this:
TryCast(UltraTree1, ISelectionManager).SetPivotItem(lnodNew, False)
I hope this helps. Please let me know if you have any other questions or concerns on this matter.
That solved it, thanks for your prompt assistance!