Definition of variables

TCE supports the definition of class variables and local variables.

Class variables are defined in the tree view of a class and have the lifetime of an object instance of that class.

Local variables are defined within a function and exist until the function is left.

Local variables are created with the DIM keyword.

Dim OK As Boolean, A() As Long

This example defines two local variables OK and A. A is a list in this case. The variable OK has the type Boolean (NoValue, False, True); List A is of type Long (32-bit integer).

 

Local variables can be given a default value.

Dim OK As Boolean := True, A() As Long := {10, 20, 30}

 

References to TCE objects can be defined as follows:

Dim Machine As ::SGM, Screws() As "Screws with metal thread ", Nuts() As ::[Nuts with metal threads]

Please note the possible different spellings for class names.

The preceding :: gives the compiler the information that the following term is a class name. If the class name has spaces or special characters, the class name can be enclosed by using square brackets.

Alternatively, class names can also be specified as a string.

 

TCE objects can be created using the keyword New, already with the variable definition as well as in the further program flow.

Dim Machine As New ::SGM
Machine := New ::SGM

 

References to COM objects are formed as follows:

Dim Connection As ADODB.Connection

 

Dim Connection As New ADODB.Connection

Connection := New ADODB.Connection

Please note that COM object types are not included in commas. COM objects can also be initialized with the New keyword.

COM objects can also be generated on the server side via the CreateObject function.

Connection := Server.CreateObject("ADODB.Connection")

On the client side, objects can only be created using the CreateObject function.

Connection := Client.CreateObject("ADODB.Connection")