RAD Studio VCL Reference
|
Creates and initializes a new form.
constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); virtual;
virtual __fastcall TCustomForm(TComponent * AOwner, int Dummy = 0);
Use CreateNew instead of Create to create a form without using the associated .DFM file to initialize it. Always use CreateNew if the TCustomForm descendant is not a TForm object or a descendant of TForm.
CreateNew bypasses the streaming in of the previously-associated .DFM file. If the form contains visual components, therefore, you must stream in an external .DFM to bind the visual components with their classes. If the newly created form has an external .DFM file, then you can follow the call to CreateNew with a call to InitInheritedComponent. If you need to create the .dfm file for the new form instance, bracket the call to CreateNew with calls to WriteComponentResFile and ReadComponentResFile. The following code sequence
WriteComponentResFile('Temp.dfm', Form1); ...
Form2 := TForm.CreateNew(Application);
ReadComponentResFile('Temp.dfm', Form2);
The first argument, AOwner, is the owner of the form (usually the application or another form is the owner). The second argument, Dummy, defaults to 0 and is not used by this constructor. The system passes 0 by default if this constructor is passed only the first argument, AOwner.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|