Result: Variant;
The Result property determines the value of the command execution result that was sent to the form. It is used if the message was sent using the SendCommand method.
Suppose that we should send a 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: