Argument: Variant;
The Argument property returns the value of the argument of the command that was sent to the form.
Suppose that we should send command from the SOURCEFORM form to the DESTINATIONFORM form. To do this, add a link to the DESTINATIONFORM form 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 as follows:
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", 21) As 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 = "Sum" Then
Args.Result := Args.Argument + Args.Argument;
End If;
If Args.Command = "Square" Then
Args.Result := Args.Argument * Args.Argument;
End If;
If Args.Command = "Difference" Then
Args.Result := Args.Argument - Args.Argument;
End If;
End Sub DESTINATIONFORMFormOnCommand;
End Class DESTINATIONFORMForm;
After the Button1 button has been pressed on the SOURCEFORM form the 21 value is sent to the DESTINATIONFORM form that squares this value and returns the result.
See also: