Chris

I imagine you've solved the problem by now.  Basically you had not
identified the correct Class node in your checking loop.

I came up with the following which I have checked :-)

procedure TForm1.AddComponents(PropertyForm: TForm);
var
  RootNode, ClassNode: TTreeNode;
  b,I:Integer;
  Temp: TComponent;
begin
  with TreeViewCompts.Items
  begin
//  Clear Existing Nodes
    TreeViewCompts.Items.Clear;
    RootNode := TreeViewCompts.Items.Add(NIL,Name); {Add the root node}

//  Sequence through all components
    for I := ComponentCount - 1 downto 0 do
    begin
      Temp := Components[I];

//    Check to see if class in tree
      ClassNode := NIL;
      for b := 0 to TreeViewCompts.Items.Count-1 do
      begin
        if TreeViewCompts.Items[b].Text = Temp.ClassName then
        begin
            ClassNode := TreeViewCompts.Items[b];
          Break;
        end;
      end;
      if ClassNode = NIL then
        ClassNode := AddChild(Node,Temp.ClassName);
      AddChild(ClassNode,Temp.Name);
    end;
  end;
end;

Cheers

Stephen
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to