Author: Tomas Rutkauskas
How can I find a TTreeView item by string parameter? I mean like TreeNode :=
indexOf(Item: String);
Answer:
If you want to track the HTREEITEM ItemID's then you could use GetNode. To search
by text you'll need to go through the list. Here is a quick option, depends on what
you are looking to do.
1 { ... }2 Form1.TreeView.Items.BeginUpdate;
3 for count := 1 to Form1.TreeView.Items.Count do4 if (Form1.TreeView.Items.Item[count - 1].Text = 'Text') then5 begin6 {your code here;}7 {Break;}8 end;
9 finally10 Form1.TreeView.Items.EndUpdate;
11 end;