No announcement yet.

Tree Object: Autoselect after removing node

  • Filter
  • Time
  • Show
Clear All
new posts

  • Tree Object: Autoselect after removing node

    For example I've created Tree Object with three nodes with indexes: "1", "2", "3". Then I'd remove node with function Tree.RemoveNode("2"). After removing -> event "On Select" occurs (unexpected..) - node with index "1" was selected automatically. How to disable this automatic option?


  • #2
    I created 3 nodes, 1, 2 and 3.
    I made a button with function Tree.RemoveNode("Tree", "2").
    In application, i press the button, node 2 was removed from a tree, and nothing was selected.

    What is your problem?
    -You have some code On Select, and when you delede node 2, it means node 2 was selected, and deleted, now, on select, node 2 doesnt exist, so error comes up. So in your case i would use Tree.SetSelectedNode("Tree", "1") to select the first node right after Tree.RemoveNode command. And make sure when you make that to made if code for case if there is nothing left in a tree, then you will be not able to select the first node. If errors continues, check on select event, if you got the same problem, you will need to make better checking systems for on select event.