Board index » delphi » onCreate vs Loaded for Forms
billboulton
![]() Delphi Developer |
Thu, 17 Feb 2005 23:26:47 GMT
|
billboulton
![]() Delphi Developer |
Thu, 17 Feb 2005 23:26:47 GMT
onCreate vs Loaded for Forms
When setting up forms, what tasks are appropriate and inappropriate for
inclusion in TForm1.Create and TForm1.Loaded. I'm particularly interested in dynamic creation of components, eg., adding a number of buttons to a panel. TIA |
Team
![]() Delphi Developer |
Fri, 18 Feb 2005 05:55:40 GMT
Re:onCreate vs Loaded for FormsQuoteIn article <3d721d6c.248...@forums.borland.com>, Billboulton wrote: inherited constructor first, then add your controls. Loaded actually executes before OnCreate, but it has the drawback that it may be called more than once if your form uses visual form inheritance. Both Loaded and OnCreate are executed "in" the inherited Create if you override the constructor. -- |
David McCallu
![]() Delphi Developer |
Fri, 18 Feb 2005 14:40:30 GMT
Re:onCreate vs Loaded for FormsWhy call the override and call the inherited constructor. I would usually declare the component as a private member of the form, then create it in the create constructor as is, e.g. procedure TFotrm1.FormCreate(Sender:TObject); "Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message Quote> In article <3d721d6c.248...@forums.borland.com>, Billboulton wrote: |
Team
![]() Delphi Developer |
Sun, 20 Feb 2005 02:54:55 GMT
Re:onCreate vs Loaded for FormsQuoteIn article <3d738843.625...@forums.borland.com>, Billboulton wrote: -- |
Christian Kaufman
![]() Delphi Developer |
Sun, 20 Feb 2005 14:03:52 GMT
Re:onCreate vs Loaded for FormsQuote>inherited constructor first, then add your controls. Loaded actually executes But should we call inherited in Loaded anyway? Can I see somehow, if cu Christian |
Team
![]() Delphi Developer |
Sun, 20 Feb 2005 22:59:09 GMT
Re:onCreate vs Loaded for FormsQuoteIn article <=KF1PR9Jk41+bsBNtGlfE43HR...@4ax.com>, Christian Kaufmann wrote: forms DFM gets loaded in turn. Quote
Quote> Can I see somehow, if and when Loaded is called more than once? form class. If FAlreadyLoaded Then Exit; .... -- |
Team
![]() Delphi Developer |
Tue, 22 Feb 2005 02:41:50 GMT
Re:onCreate vs Loaded for FormsQuoteIn article <3d776fc0.3448...@forums.borland.com>, Billboulton wrote: OnCloseQuery. Quote> But, with certainty, _only_ for that particular component which is known to component has been loaded. Quote> Now all we need is an auto-create thingy which can perform any remaining Quote> How safe would it be to use PostMessage in the overridden constructor of the though. I usually use such a message to trigger processing that should only start after the form has been shown. Quote> My block is entered. A forms handle will be created when code first refers to it, or when the form is first shown, whatever happens first. -- |
billboult
![]() Delphi Developer |
Wed, 23 Feb 2005 00:11:58 GMT
Re:onCreate vs Loaded for FormsOn Thu, 05 Sep 2002 20:41:50 +0200, "Peter Below (TeamB)" Quote<100113.1...@compuXXserve.com> wrote: Quote>The Application object already has a valid handle before the DPR files main Now that is _interesting_. Peter, I can't thank you enough. This thread has opened up a host of Sincerely, |