Link to home
Start Free TrialLog in
Avatar of sakya
sakya

asked on

control array

Hello.

I want to use control array like Visual Basic.
Can I program component as array?
Please teach me how to program and a example.

 
Avatar of pjdb
pjdb

For example, an array of 3 edit boxes (alreadyt defined on the form)

in the private part of the form put : MyControlArray=Array[0..2] Of TEdit;
in the OnCreate event of the form put :
MyControlArray[0]:=Edit1;
MyControlArray[1]:=Edit2;
MyControlArray[2]:=Edit3;

Then you can use them whereever you want by either using Edit1, Edit2, Edit3 or MyControlArray[i].
Avatar of sakya

ASKER

Yes,but I know this way.
I want more cool code because my application has hundreds of components,

Help.


Any component has property Components and ComponentCount.
Components lists of all components owned by the component.

Any wincontrol has property Controls and ControlCount.
The Controls property is an array of all controls that are children of the windowed control.

Try to use it.

you could also use a TList to contain your components...
Avatar of sakya

ASKER

Thanks vladika.
Thanks ZifNab.

I will try.



ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sakya

ASKER

viktornet. Thanks for  your good  examples.