Repeatedly find items that contain the same string

TeeTree VCL for Borland Delphi and C++ Builder.
Post Reply
achristouio
Newbie
Newbie
Posts: 21
Joined: Mon Jan 23, 2006 12:00 am

Repeatedly find items that contain the same string

Post by achristouio » Mon May 11, 2009 3:27 pm

In an application I want to find all nodes that contain eg. the words "plot.plott".

I do not find a method that repeatedly give me the next node that fit the word, only the first node as in the TreeRoots.pas example.

Is the needed action not available or do I miss something obvious ??

tom
Advanced
Posts: 211
Joined: Mon Dec 01, 2003 5:00 am
Contact:

Re: Repeatedly find items that contain the same string

Post by tom » Thu Jun 18, 2009 8:57 pm

There is no method to retrieve nodes as such, however, you can implement this on a relatively easy way. The Shapes property contains all the nodes in the tree, so you can iterate these and perform your match on every node, as in:

Code: Select all

procedure TForm2.FindNodesClick(Sender: TObject);
var t: integer;
begin
  for t:=0 to Tree1.Shapes.Count-1 do
  if (Pos('TreeNode',Tree1.Shapes[t].SimpleText)>0)then
  begin
    Showmessage(Tree1.Shapes[t].Name);
  end;
end;
Regards,
Tom.

Post Reply