[fpc-pascal] Application.onChangeComponentCount ?

Fred van Stappen fiens at hotmail.com
Mon Jun 17 20:57:33 CEST 2013

> >
> > Hello.
> >
> > Is there a plan to add a function like Application.onChangeComponentCount ?
> >
> > I want to catch a signal when a new form is created (or deleted).
> > I know that the best way is to create a parent form and from this use
> > the form.oncreate event.
> > But if the form has no parent the only way to know if a new form was
> > created (or deleted) is to check if Application.ComponentCount was
> > changed. (with a timer)
> > So i will be happy if a function like
> > "Application.onChangeComponentCount" is added in Application class.
>  > TApplication is part of the LCL not the FCL.
> Aaargh, ok, so sorry to disturb (but i will be happier if TApplication
> was part of FCL). ;-)

> No, because TApplication needs references to GUI related things (e.g. on 
>Windows a reference to a hidden application window). The FCL is not 
> about GUI, so TApplication has no place there. For programs that don't 
> need a GUI you can take a look at TCustomApplication in unit CustApp 
> however (which TApplication also inherits from).

> Regards,
> Sven

Many thanks Sven, but, if i understand well, TApplication is herited from TCustomApplication.

And in TCustomApplication there is addobject property.
So maybe it could be possible to know if a new object was created at runtime (or deleted)?
And all that without  TApplication, directly with fp ?

But maybe i dream, i have to add a new function in LCL TApplication like :

PS : I have ask it to Delphi forum too, the answer was : no, it is not possible to know if a new form was created/deleted, the only way is to create a custom form with custom onCreate and onDestroy and deal with this child forms.

PS2 : But fpc is much powerfull than Delphi, so, maybe... ;-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130617/7213235c/attachment.html>

More information about the fpc-pascal mailing list