LOTUSSCRIPT LANGUAGE
Define a property. A property is a named pair of Get and Set procedures that can be used as if they were a single variable.
Syntax
[ Static ] [ Public | Private ] Property { Get | Set } propertyName [ ( [ paramList ] ) ] [ As type ]
[ statements ]
End Property
Elements
Static
A property in module scope is Private by default. A property in class scope is Public by default.
The Property Get and Property Set definitions for a property must use the same Public or Private setting.
The syntax for each parameter declaration is:
[ ByVal ] parameter [ ( ) | List ] [ As type ]
parameter() is an array variable. parameter List identifies parameter as a list variable. Otherwise, parameter can be a variable of any of the other data types that LotusScript supports.
As dataType specifies the variable's data type. You can omit this clause and append a data type suffix character to parameter to declare the variable as one of the scalar data types. If you omit this clause and parameter has no data type suffix character appended (and isn't covered by an existing Deftype statement), its data type is Variant.
type can be any of the scalar data types, a Variant, or a class name.
If As Type is not specified, the property name's data type suffix character determines the value’s type. Do not specify both a type and a data type suffix character, as LotusScript treats that as an error.
If no type is specified and the property name has no data type suffix character appended, the property's value is either of data type Variant or of the data type specified by a Deftype statement.
The types in the Property Get and Property Set definitions must be the same.
The Public keyword cannot be used in a product object script or %Include file in a product object script, except to declare class members. You must put such Public declarations in (Globals).
A property usually consists of two procedures with the same name: a Property Get and a Property Set. However, you are not required to provide both.
A property member of a class cannot be declared Static. That is, a Property Get or Property Set statement within a class definition cannot begin with Static.
Using Property Get
A Property Get procedure is like a function. For example:
' These statements assign the value of saveInt to x Dim saveInt As Integer Property Get pInt As Integer pInt% = saveInt% End Property x = pInt%
Or:
' These statements assign the value of saveInt plus ' increment to x Dim saveInt As Integer Property Get pInt (increment As Integer) As Integer pInt% = saveInt% + increment% End Property x = pInt%(1%)
Using Property Set
A Property Set procedure is the reverse of a Property Get procedure. On entry into a Property Set procedure, an implicitly declared variable whose name and data type are the same as those of the Property Set procedure contains a value to be used inside the Property Set procedure. Inside the Property Set procedure, use the value of the variable instead of assigning a value to it.
Call a Property Set procedure by using its name on the left side of an assignment statement. The value on the right side of the statement is used by the Property Set procedure. For example:
' These statements assign the value of x to SaveInt Dim SaveInt As Integer Property Set pInt As Integer saveInt% = pInt% End Property pInt% = x
' These statements assign the value of x + increment ' to SaveInt Dim SaveInt As Integer Property Set pInt (increment As Integer) As Integer saveInt% = pInt% + increment% End Property pInt%(1%) = x
Referencing a property that returns an array, list, or collection
If a Get operation returns an array, list, or collection, a reference to the property can contain subscripts according to the following rules:
Passing a property to a function
A LotusScript property (a property defined by Property Get or Property Set) can be passed to a function by value only, not by reference.
Example See Also