Parent-Child Hierarchy
The TQTXWidget class mirrors the Delphi/VCL component model. When you create a widget with an Owner (e.g., TQTXButton.Create(MyForm, ...)), two things happen:
- Pascal Side: The new button is added to MyForm's fChildren array.
- DOM Side: The ChildAttach method is called, which physically appends the button's Handle to the form's Handle using appendChild.
This dual relationship means the Pascal object hierarchy and the live DOM tree are always in sync. When you Free the form, it iterates its fChildren array and frees each child; this, in turn, causes each child to remove its Handle from the DOM, resulting in a clean, top-down destruction of your components.