Owners and Parents Was: Re: [lazarus] Creating Components...

Samuel Liddicott sam at campbellsci.co.uk
Mon Aug 16 04:57:51 EDT 1999




> -----Original Message-----
> From: Marc Weustink [mailto:weus at quicknet.nl]
> Sent: 13 August 1999 10:15 PM
> To: daworm at cdc.net
> Cc: lazarus at miraclec.com
> Subject: Re: Owners and Parents Was: Re: [lazarus] Creating
> Components...
>
>
> At 15:47 13-08-99 -0400, "Jeff Wormsley" <daworm at cdc.net> wrote:
> >On 8/13/99, at 9:41 PM, Marc Weustink wrote:
> >
> >>First I think the window shouldn't be created by then. Create it when it
> >>has a parent (it has no graphical function anyhow)
> >>But if you have to ....
> >>You can change the parent of any window whose hwnd you know to any other
> >>parent by  the winapi function SetParent:
> >>
> >>HWND SetParent(
> >>    HWND hWndChild,	// handle of window whose parent is changing
> >>    HWND hWndNewParent 	// handle of new parent window
> >>   );
> >
> >Ok, that's not a problem then.  But, if I shouldn't create the
> window until
> >it has a parent (except perhaps the MainForm???)
>
> Yes it depends on the window style. If is is ws_child (a control is mostly
> a child) then this applies. A form is created after is is visible (!)

Yes but this is a hack in the VCL.  For forms the "visible" property is
treated specially when the form is being loaded from the .dfm file.

Sometimes the form will get a window handle created before all the
properties have been loaded from the .dfm file, as a result of what some of
the properties values are.

> FComponent was if I remember it (from this list) the HWND of that
> component.

Surely not!  What is FHandle for then?

Sam






More information about the Lazarus mailing list