Array of components property
Posted on 2001-09-09
I have 2 components that I am writing, let's call them TComponent1 and TComponent2.
Now TComponent1 needs to have an array of TComponent2's as a property that can be indexed. The closest thing that I can think of in Delphi's VCL to this is the TPopupMenu and TMenuItem, or TPageControl and TTabSheet.
There needs to be an easy way for the user of the components to...
* Interate through the array as a property in TComponent1 to access the TComponent2s.
* Allow instances of TComponent2 to be Added to the array property in TComponent1.
* Delete instances from the array property.
* Change the order of the items in the array property.
* Count the number of items in the array property.
I assume I would need a linked list somewhere (TList). Would anyone be able to give me any source code that would demonstrate the above?
Thanks in Advance,