[fpc-pascal] Re: fpc-pascal Digest, Vol 72, Issue 12
Dimitri Smits
smitco at telenet.be
Fri Jun 4 02:02:09 CEST 2010
Graeme Geldenhuys wrote:
>> In LCL the owner is always the form. Otherwise the form variables
>> would not work.
>
> I know that, and the same think applies to VCL. But again, I don't see
> why Borland had to do that. Like fpGUI proves, it's not even required
> to have Owner and Parent. fpGUI can easily remove Parent and just use
> Owner and work perfectly. At the moment in fpGUI, Parent is just for
> convenience to VCL/LCL developers - it's just an alias for Owner.
Parent and Owner are what they say they are.
Owner: the TComponent that "owns" the TComponent-descendant. In other words, that is responsible for the lifecycle of that instance.
Parent: the control on which the control is visualised.
It is not because by default the LCL or VCL don't keep those in sync in most cases, that it is redundant. I've seen plenty in my 10+ Delphi years of code where a control is created by another TComponent and where the parent is set to a control on a(nother) Tform or container.
Whether or not that is good design in all cases is not the issue. The point is that they do not need to be the same. (as well as Parent can be a container)
I then conclude from your case above, Graeme, that fpgui does not work with containers like TPanel/TGroupbox/... and does not allow to "inject" extra visual controls on another form?
kind regards,
Dimitri Smits
More information about the fpc-pascal
mailing list