Recent

Author Topic: componentcount  (Read 5772 times)

RobyWan

  • New Member
  • *
  • Posts: 13
componentcount
« on: October 28, 2010, 05:19:15 pm »
Hi everibody!
I need to obtain all names of the component in a form, for various use.
I try to do so, for put them in a memo

  memo2.clear;
  for i:=0 to frmcartellini.ComponentCount-1 do      // chi è il 4 componente?
     begin
           memo2.lines.add(frmcartellini.controls.name);
     end;

but at the 4 index I obtain a bound error (components are more of 1 hundred), panel, query, tsheet, tedit, combobox and so on.
Where is the trouble?
I need all name so I can made a routine in which, for example, I can enable or disable all components whitout write all their name in the code...
My Lazarus 0.9.29 svn 27658 12/10/2010

Thank to everybody

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: componentcount
« Reply #1 on: October 28, 2010, 05:28:30 pm »
Use
Code: [Select]
memo2.lines.add(form1.components[i].name);  or
Code: [Select]
for i:=0 to form1.controlCount-1 do
Components  > Controls
« Last Edit: October 28, 2010, 05:30:36 pm by anna »
WinXP SP3 Pro Russian 32-bit (5.1.2600)

RobyWan

  • New Member
  • *
  • Posts: 13
Re: componentcount
« Reply #2 on: October 28, 2010, 05:32:30 pm »
Thank, Anna
So it is a bit better
Now I work on it

 

TinyPortal © 2005-2018