When a component is created, it can be assigned an owner component, which will be responsible for destroying it.
So, every component can have an owner and can also be the owner of other components.
For example, you can use the following code to add to a list box the names of all a form's components (this code is part of the Change Owner example presented in the next section): In Delphi, some components are also component containers: the Group Box, Panel, Page Control, and, of course, Form components.
When you use these controls, you can add other components inside them.
When you use the Form Designer or Data Module Designer of the IDE, that form or data module will own any component dropped on it.
At the same time, you should generally create components with a form or data module owner, even in your code.
Click the two List buttons before and after moving the component, and you'll see what happens behind the scenes.
As a final feature, the Every component in Delphi should have a name.
The name must be unique within the owner component, which is generally the form into which you place the component.
Be warned that the topic covered is not simple; if you're just beginning with Delphi, you might want to come back to this section at a later time.
To change the owner of a component, you can call the Insert Component and Remove Component methods of the owner itself, passing the current component as parameter.
I won't explore all the details of the class, some of which are more important for component designers than they are for component users.