Form.CreateForm

Syntax

CreateForm([Parent: IWin32Window = Null]);

Parameters

Parent - form that should be an owner of the created form.

If the parameter is not specified, the created form should be equal to that, in which it was created.

Description

The CreateForm constructor creates a new form.

Comments

Set the Visible property to True to open the created form. If the Parent parameter is specified, the created form is always displayed over the specified parent window. Parameters of the parent window are also available in the ParentWindow property.

The ShowModal method can be used to open a form. The form opens modally relative to the specified parent window.

NOTE. If Null is passed as a value of the Parent parameter on form creation, and the ShowModal method is used to display the form, the form opens modally relative to the object navigator.

Example

Executing the example requires a form and a button named Button1 on it. The repository contains a form named TestForm. The link to this form is added in the inspector of assemblies for the current form.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

f: Form;

Begin

f := New TestForm.CreateForm(Self As IWin32Window);

f.Visible := True;

End Sub Button1OnClick;

After executing the example the TestForm form is created and displayed.

See also:

Form