• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

Find substring in a node in treeview

How can i find a part of node in a treeview and set focus ot node
0
Peev711
Asked:
Peev711
  • 2
  • 2
  • 2
1 Solution
 
MerijnBSr. Software EngineerCommented:
You can set the selected Node with
Treeview1.Seleteced := Treeview1.Items[0];

What do you mean with 'find a part of a node'?
0
 
Peev711Author Commented:
I . want to find part of a node and then node be  selected for example
TreeView with this
-My Home is a sweet
-Sweet my home
- City
- Town
I loock for second home in second node.
.
0
 
Geert GruwezOracle dbaCommented:
for I := 0 to TreeView1.Items.Count-1 do
  if Pos(seachtext, TreeView1.Items[I].Caption) then
    Treeview1.Seleteced := Treeview1.Items[I];
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MerijnBSr. Software EngineerCommented:
Little tweak on Geert_Gruwez code.

Did you want to select multiple nodes if more nodes match?
for I := 0 to TreeView1.Items.Count-1 do
  if Pos(seachtext, TreeView1.Items[I].Caption) then
  begin
    Treeview1.Seleteced := Treeview1.Items[I];
    break;
  end;

Open in new window

0
 
Peev711Author Commented:
I see TreeView select  the first one item.
How can i get a next one it a put a Button for example, and next one
0
 
Geert GruwezOracle dbaCommented:
by tweaking the previous code
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now