Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Components vs Children in FireMonkey

Author: Jayme Jeffman Filho

You have probably iterated through the Components array many many times as a Delphi developer.

Consider this simple application:

It’s probably no surprise that listing the Components of the form like this…

[crayon-676dbbb354647126953382/]

…gives you the following output, which is very similar to the Structure View in the IDE, except that it doesn’t show the relationships between the components.

Listing the children, and the children of all children (recursively) is simply done by using this procedure:

[crayon-676dbbb35464e846303555/]

The above code will give us a tree output with indentation to show us the children, grandchildren, etc, like this:

The list of children is much longer than you would possibly except at first. We see for instance that in FireMonkey a TButton consists of a TLayout, a TSubImage and a TText. The TSubImage and the TText in turn have 4 animations each to handle hover-in/hover-out and pressing/releasing. Likewise the TMemo holds scrollbars, a popup context menu, and much more.

The entire output from ListChildren follows below:

[crayon-676dbbb354650498739977/]

Enjoy!

Exit mobile version