IWebForm.ShowModal

Syntax

ShowModal;

Description

The ShowModal method opens web form modally relative to the object, from which code is executed.

Comments

The use of this method is available only in the web application. The web form, for which the method is called, should be opened using the IMetabaseObjectDescriptor.Open or IMetabaseObjectDescriptor.OpenWithParam method.

Example

Executing the example requires that the repository contains two web forms with the SOURCEF and DESTINATIONF identifiers. The first form contains a button. The second form contains two Input components, and a handler of OnCommand event is created.

Add links to the Metabase and WebForm system assemblies.

The first form code:

Class SOURCEFWebForm: WebForm
    Button1: WebButton;
    
    Sub Button1OnClick;
    Var
        Mb: IMetabase;
        wForm: IWebForm;
        Result: Variant;
    Begin
        Mb := MetabaseClass.Active;
        wForm := Mb.ItemById("DESTINATIONF").Open(nullAs IWebForm;
        Result := wForm.SendCommand("command1"100);
        wForm.ShowModal;
        Self.Text := Result;
    End Sub Button1OnClick;
End Class SOURCEFWebForm;

The second form code:

Class DESTINATIONFWebForm: WebForm
    Input1: WebInput;
    Input2: WebInput;

    Sub DESTINATIONFWebFormOnCommand(Args: IWebCommandEventArgs);
    Begin
        Input1.Text := Args.Command;
        Input2.Text := Args.Argument;
        If Args.Command = "command1" Then
            Args.Result := "1";
        Elseif args.Command = "command2" Then
            Args.Result := "2";
        Else
            Args.Result := "0";
        End If;
    End Sub DESTINATIONFWebFormOnCommand;
End Class DESTINATIONFWebForm;

Starting the first web form and clicking the button will initialize the second web form. The command will be sent for the web form, after which the web form will be opened modally relative to the first web form. After the second web form is closed, the command processing result will be returned and displayed in the first web form title.

See also:

IWebForm