Form Variables: PML Variables within a Form
- Last UpdatedOct 25, 2022
- 1 minute read
It is often convenient to store additional information on a form which will not be displayed to you. This is achieved by defining form variables.
These are variables which can be any of the PML data types, including ARRAYS and OBJECTS. These variables have the same lifetime as the form and are deleted when the form itself is killed.
Form members are defined in just the same way as object members:
layout form !!MyForm...
:
member .MyNumber is REAL
member .MyString is STRING
member .MyArray is ARRAY
:
exit
The value of a form member can be set and used in just the same way as an object member:
!!MyForm.MyNumber = 42
!Text = !This.MyNumber
!ThirdValue = !This.MyArray[3]
In a callback function you can use !this. to represent 'this form':
!ThirdValue = !This.MyArray[3]