[fpc-pascal] WriteComponent not outputting a hierarchy of components?

Michael Van Canneyt michael at freepascal.org
Thu Jun 3 17:24:32 CEST 2010



On Thu, 3 Jun 2010, Graeme Geldenhuys wrote:

> I'm using FPC 2.4.1
>
> I'm experimenting with streaming (read & write) components to build a form
> and runtime from an external file (something like GTK2 has with Glade). I
> have a ReadForm() method very similar to the SaveForm below, and it works
> pretty well. All components placed directly on the form are loaded and
> displayed correctly, except if you have nested components. eg: a Panel on
> the Form and then components inside the Panel.
>
> I thought that maybe I am creating the *.frm files (text object format of
> form) incorrectly, so wrote the code below to see what the RTL does
> automatically for me.
>
[]
> ----------------[ end ]----------------------
>
>
> What is WriteComponent() looking for to traverse a Form?

You must override GetChildren.

In the LCL, TWinControl overrides GetChildren to write child controls.

It is documented.

Michael.



More information about the fpc-pascal mailing list