Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
860
keep 2 ultratrees vertically synced
posted

Hi

I have 2 ultratrees side-by-side with the same number of rows.

How do I keep them in sync?

  • when closing/opening a group
  • when scrolling with keyboard or mouse
  • 469350
    Offline posted

    Hi,

    There's no simple way to do this unless you can find the matching node in the other tree. So if your tree's both contain the same nodes with the same keys, then you could trap the events of the first tree like AfterExpand and AfterCollapse. Then you could find the matching node in the other tree and expand/collapse it as appropriate.

    For scrolling, you would do the same thing using the Scroll event of the tree and set the FirstNode property of the other tree to the matching node in the current tree.

    If the nodes have keys, then finding the node in the other tree is pretty easy, you can use the tree.GetNodeByKey method. If your nodes are not keyed, then you would have to use the node indices and walk down the hierarchy recursively to find the matching node in the other tree.