From RAD Studio API Documentation
Jump to: navigation, search


/* TCustomForm.Create */ inline __fastcall virtual TForm(System::Classes::TComponent* AOwner) : TCustomForm(AOwner) { }
/* TCustomForm.CreateNew */ inline __fastcall virtual TForm(System::Classes::TComponent* AOwner, NativeInt Dummy) : TCustomForm(AOwner, Dummy) { }


Type Visibility Source Unit Parent
constructor public FMX.Forms.hpp FMX.Forms TForm


Creates and initializes a TForm instance.

This is the constructor for TForm.

For Delphi, the constructor for TForm is FMX.Forms.TCustomForm.Create. A description of the constructor for both Delphi and C++ is located at FMX.Forms.TCustomForm.Create.

Most applications do not call TForm, but rather instantiate a descendant of TForm that is defined in the forms designer. Forms added to an application at design time are created automatically.

Pass a single Component as a parameter to provide the form with an Owner (usually the application) that is responsible for freeing it. This is the most commonly used constructor syntax.

Pass a Component and an integer to create the form while bypassing the streaming system that loads a form’s properties and descendants from a .FMX file. The second parameter (Dummy) serves only to distinguish this constructor from the first. This constructor is rarely used for form objects. When using this syntax, stream in an external .FMX to bind the visual components with their classes. WriteComponentResFile and ReadComponentResFile must bracket the constructor call. The following code sequence:

  1. Streams out an external .FMX file.
  2. Creates a new form disassociated from any .FMX resource file.
  3. Streams in the external .FMX file and binds it to this new form.
WriteComponentResFile("Temp.fmx", Form1);
// ...
Form2 = new TForm(Application, 1);
ReadComponentResFile("Temp.fmx", Form2);