ICommandEventArgs.Argument

Syntax

Argument: Variant;

Description

The Argument property returns the value of the argument of the command that was sent to the form.

Example

Suppose that we should send command from the SOURCEFORM form to the DESTINATIONFORM form. The reference to the DESTINATIONFORM form must be added to the inspector of assemblies in the SOURCEFORM form. The word Public must be added to the description of the class of the DESTINATIONFORM form.

After all actions the text of the macro for the SOURCEFORM form should look like that:

Class SOURCEFORMForm: Form
    Button1: Button;

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        DestForm: DESTINATIONFORMForm;
        Res: string;
    Begin
        DestForm := New DESTINATIONFORMform.CreateForm;
        Res := DestForm.SendCommand("Square"21As String;
        WinApplication.InformationBox(Res);
    End Sub Button1OnClick;
End Class SOURCEFORMForm;

For the DESTINATIONFORM form:

Public Class DESTINATIONFORMForm: Form
    Sub DESTINATIONFORMFormOnCommand(Sender: Object; Args: ICommandEventArgs);
    Begin
        If Args.Command = "Amount" Then
            Args.Result := Args.Argument + Args.Argument;
        Elseif Args.Command = "Square" Then
            Args.Result := Args.Argument * Args.Argument;
        Elseif Args.Command = "Difference" Then
            Args.Result := Args.Argument - Args.Argument;
        End If;
    End Sub DESTINATIONFORMFormOnCommand;
End Class DESTINATIONFORMForm;

After the Button1 button has been clicked on the SOURCEFORM form, the 21 value is sent to the DESTINATIONFORM form that squares this value and returns the result.

See also:

ICommandEventArgs