[Lazarus] Hint about CreateWnd

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Mar 1 16:07:55 CET 2008


On Sat, 01 Mar 2008 11:40:34 -0300
Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:

> Mattias Gaertner wrote:
> > On Sat, 1 Mar 2008 13:14:05 +0100
> > zeljko <zeljko at holobit.net> wrote:
> >
> >   
> >> I'm creating an customized control, and have such hint when
> >> creating form with such control:
> >>
> >> [HINT] TWinControl.CreateWnd creating Handle during loading
> >> Form1:TForm1 csDesigning=False
> >>
> >> Is this something bad , or I can live with it ?
> >>     
> >
> > It's bad.
> > It creates a lot of unneeded overhead.
> > As long as the control is csloading, csdestroying or not becomes
> > visible a Handle is not needed and should not be created.
> >
> > Use 'if csLoading in ComponentState' to find out if it is still
> > loading. Loading is finished when 'procedure Loaded;' is called. You
> > can override that.
> >   
> 
> Is allowed to access Handle at TForm.OnCreate event?

Yes, with 'if HandleAllocated then'.

Mattias



More information about the Lazarus mailing list