CreateFormControl(pParent: Object): Object;
pParent. A form that will be the owner of a form that is being created.
An object, implemented by the interface, should be passed as a parameter value. IWin32Window. If the Null value is passed as a value, the form that is being created will be equal to that, in which it was created.
The CreateFormControl method creates a new form and returns a context for managing this form.
To access parameters of the created form, the result of method functioning needs to be cast to the IFormControl type.
To open the created form, set the Visible property to True. If the pParent parameter is specified, the created form is always displayed above the specified parent window. Parent window parameters are also available in the ParentWindowproperty .
The ShowModal method can also be used to open the form. And the form is open in a modal mode relatively to the specified parent window.
NOTE. If the Null value is passed as a value of the pParent parameter during form creation, and the ShowModal method is used to display the form, the form is opened in a modal mode relatively to the objects navigator.
Executing the example requires a form and a button named Button1 positioned on it. The repository also contains a form with the TestForm identifier.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
f: IFormControl;
Begin
MB := MetabaseClass.Active;
f := (MB.ItemById("TestForm").Bind As IForm).CreateFormControl(Self) As IFormControl;
f.ShowModal;
End Sub Button1OnClick;
After executing the example, the TestForm form is created and displayed. This form is opened in a modal mode relatively to the form, during which execution it was created.
See also: