Delegate.Invoke

From Xojo Documentation

Method

Delegate.Invoke(...) As ...

Supported for all project types and targets.

Call the method pointed by the delegate. You must pass the same parameters as the method's ones and, if the method returns a value, you must use the return value as well.

Sample Code

If you defined a delegate as:

Delegate Sub myDelegateMethod(x As Integer, y As Integer, s As String)

then you must use Invoke with the same parameters' type, as in:

Var d As myDelegateMethod
// <— Set d as your code requires
d.Invoke(1, 10, "An example string") // Values are indicative

By contrast, if the Delegate is set to return a value as in:

Delegate Function myDelegateMethod(x As Integer, y As Integer, s As String ) As Boolean

then you must use the value returned by Invoke, as in:

Var d As myDelegateMethod
Var b As Boolean
// <— Set d as your code requires
b = d.Invoke(1, 10, "An example string") // Values are indicative