XojoScript.Context

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Object )
aXojoScript.Context = newObjectValue
or
ObjectValue = aXojoScript.Context

Supported for all project types and targets.

The object (e.g., window or class) that is made available to the XojoScript. The object's methods and properties become global methods and properties available to the script.

Notes

You cannot pass any objects between the context and the script. This includes, for example, dates, variants and arrays. Any methods or properties that use objects will not be allowed within the script.

For example, you can create a custom class and assign it to the Context property. The script would then have access to the methods and properties of this class. The methods become global methods and the properties become global properties.

Constants defined on the Context are replaced at compile time, which essentially means the constants do not exist for the XojoScript to reference. As an alternative, you can use a read-only computed property like a constant and it will be available in the XojoScript.