Actually I want to set the focus on the exact node that I have specified.
For example, if I was using a DBGrid connecting to a dataset, I could use Locate as in
myDataSet.Locate('NodeiD',
Grid1.SetFocus; // current row is record where NodeID = iNodeID
How do I achieve the same thing with TreeView?
function GoToNode(iNodeID: Integer): Boolean;
begin
TreeView1.SetFocus;
Result := TreeView1.LocateNode(iNode
end;
Main Topics
Browse All Topics





by: Geert_GruwezPosted on 2009-08-12 at 05:21:33ID: 25077905
you'll need to somehow store the relationship between your NodeId and the Index
and recalculate all the indexes when moving nodes around
i tried with the sample below
basically for every node you add or move place all the indexes get recalculated
you could find the node faster using the parentid and working in reverse order.
first list all the parents upwards until you get the top parent and then work downwards again to find the node
Select allOpen in new window