Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
Delphi

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…

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


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Related posts
CodeDelphiRAD StudioTech Partner

Learn How to Use The MQTT Protocol in Delphi With This Library

CodeDatabaseDelphiRAD Studio

Flexible InterBase AdminUtility Sample Tours You Through Powerful InterBase Features

CodeDelphiRAD Studio

Learn How To Migrate dbExpress To FireDAC With The reFind Tool In This Delphi Sample

CodeDelphiRAD Studio

FireDAC Tip: Write Database Independent SQL Commands With Escape Functions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES