Do code method

Command group Flag affected Reversible Execute on client Platform(s)
Methods NO NO NO All

Syntax

Do code method code-class/method-name (parameters) Returns return-value

Description

This command runs the specified code class method, and accepts a value back from the called method. The specified method-name must be in the code class code-class. The command accepts a value back from the called method if you specify a return-value. The return field can be a variable of any type.

When a code class method is executed using this command, control is passed to the called method but the value of $cinst is unchanged, therefore the code in the code class method can refer to $cinst. When the code class method has executed, control passes back to the original executing method. The current task is not affected by execution moving to the code class.

Passing Parameters

You can include a list of parameters with the Do code method command which are passed to the called method. If the called method has fewer parameters than values passed to it, the extra values are ignored.

Note that where the return field is an item reference, the command sets the reference but does not assign to it: you must do this with Calculate or Do Itemref.$assign(value).

Example

# Call the method myMethod in the code class
# myCodeClass on a click event and pass the
# value of iMyVar as a parameter
On evClick
  Calculate iMyVar as 100
  Do code method myCodeClass/myMethod (iMyVar)