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…
…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:
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:
Enjoy!