There are two places you could be referring to by Create event. You could mean the Forms OnCreate event. If so then this event occurs after the DFM is read and all the components exist (exception: Delphi 3 or earlier, or if the TCustomForm.OldCreateOrder property is set to True - read about in the help).
You could mean overriding th Forms constructor Create method (see Conor's post for an example). If so then it depends whether you put your code before or after the inherited call. If you put your code before the inherited call then it will run BEFORE the DFM has been read and components will not exist. However if you put your code after the inherited call then you should be fine (note that this code will generally run before the Forms OnCreate event). Note some confusing things can happen when you have your own form hierarchy with code in both OnCreate events and Constructors. It's probably best to stick to just using one of the other. Lastly there is an OnShow event which gets triggered when your form becomes visible. Unlike OnActivate this shouldn't get triggered every time your form gets focus (unless you make it invisible and then show it again). David. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Bird Sent: Wednesday, 10 August 2005 2:42 p.m. To: 'NZ Borland Developers Group - Delphi List' Subject: [DUG] Delphi internals - form events Form create versus activate. If I understand correctly, program initialisation best goes into the create event. I have worked out that the onactivate event for a main form fires every time any second form closes and focus returns to the main form. Is there any limitation about what can be put in the create event, I am wondering because before Delphi I did some FoxPro and there was some things to do with eg visual properties of components that could not be put in the Create event as they didn't really exist yet....such things as (I think) button1.visible:=false. Does Delphi have this kind of limitation or anything you cannot do when the form is created but before it is shown? Any general hints of what to put in each event would be appreciated. Thanks John B _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://ns3.123.co.nz/mailman/listinfo/delphi
