Re: Adding nodes to a treeview
[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]
Posted by WAllison on January 08, 2003 at 20:14:01:
In Reply to: Adding nodes to a treeview posted by Sal on January 08, 2003 at 18:11:11:
: I have a treeview that has child nodes added dynamically. After a new node is added, I'd like it to be the last node so I can select it automatically with treeview.selected := treeview.items.item[i], where i = treeview.items.count - 1. SortType is stNone.
: The problem is that the new nodes aren't always added at the end.Sometimes they're at the beginning, other times in the middle.
: Is there a way to ensure new nodes are the last nodes, or failing that, to force selection of a new node regardless of where it is? Thanks. Using D5.
ll of the functions that add/insert nodes return a TTreeNode - this contains the index
of the node. If it's a custom component - add a an event which is called when a node
is added which returns the TreeView object - or u could say:
TreeView.Selected := TreeNode;
if u need some help wif that - give us a shout.
Related Articles and Replies:
[ DelphiLand Discussion Forum ]