Board index » delphi » Select a treeview node by label

Select a treeview node by label

Hello

How can I select a treeview node by the label's text?

Regards
Jnos

 

Re:Select a treeview node by label


Here's one way:

function GetNodeByCaption(NodeCaption: String): TTreeNode;
var
    X: Integer;
begin
    Result := nil;

    for X := 0 to TreeView1.Items.Count - 1 do
    begin
        if (TreeView1.Items[X].Caption = NodeCaption) then
            Result := TreeView1.Items[X];
            BREAK;
    end;
end;

Tom

Quote
> Jnos Schmidt wrote:
>...
> How can I select a treeview node by the label's text?
>...

Re:Select a treeview node by label


Thanks, it's fine. - I must  have had a real blackout, not to have seen
it! (Don't work too much, it isn't good!)

Jnos

Other Threads