> --- Chris Wallis <[EMAIL PROTECTED]> wrote:
(with different indentation)
> Hi
>
> with TreeViewCompts.Items do
> begin
> for I := ComponentCount - 1 downto 0 do
> begin
> Temp := Components[I];
> for b := 0 to TreeViewCompts.Items.Count-1 do
> if TreeViewCompts.Items[b].Text = Temp.ClassName
then
>
TreeViewCompts.Items.AddChild(TreeViewCompts.Items[b],Temp.Name);
> AddChild(Node,Temp.ClassName);
> end;
> end;
Hi Chris, this method is not doing what you want, as
it is adding
a Component Class node // AddChild(Node,
Temp.ClassName)
for every component (probably just an indentation
issue ;-) Also, it only adds a component name when it
finds
a matching component class node (if
TreeViewCompts.Items[b].Text ...)
I can't see how the first label is getting added to
the first 'TLabel'
node, unless perhaps you have some design-time nodes?
If so, these could be hindering your bug-chasing.
What I think you want is
for each component in Components
Search for a component-class node
if not found, create it
add child component-name node to (found or created)
node
Also, at the start, you are clearing when the count is
zero:
shouldn't this be clearing when non-zero?
Cheers.
/Kurt.
_____________________________________________________________________________
http://store.yahoo.com.au - Yahoo! Store
- The fastest, easiest way to open an online store.
---------------------------------------------------------------------------
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"