ProvideX V8.20 > Language Reference > 2. Directives
259
PROPERTY Directive
            Declare Object Properties
Format
1. Declare Property: PROPERTY prop1 [OBJECT], prop2 [OBJECT], ...
2. Specify Read Procedure: PROPERTY prop1 [OBJECT] GET label | ERR, prop2 ...
3. Specify Write Procedure: PROPERTY prop1 [OBJECT] SET label | ERR, prop2 ...
Where:
ERR
Keyword blocking reads or writes to a property following a GET/SET
declaration.
GET
Keyword indicating that logic is to be called when properties are read.
Line label indicating GET or SET logic entry point.
label
OBJECT
Optional keyword identifies that the property contains an object identifier
to another object.
prop1,
Property names ­ treated like any other variable in the system. (In
prop2 ..
Object Oriented Programming, data is referred to as properties.)
SET
Keyword indicating that logic is to be called when properties are written.
Description
The PROPERTY directive is used in Object Oriented Programming to declare the
properties that can be accessed by the application program. These properties can be
treated like any other variable in the system and are accessible using the
Apostrophe Operator, p.828.
A property name can be followed by a GET label to define the location of the logic to
call whenever the property is read in the application. With GET in place, the
specified logic issues a RETURN value that returns the actual value of the property to
the application;e.g.,
PROPERTY ExtendedAmount GET Extension
...
Extension:
RETURN Quantity * Price
If the logic resides outside of the defining program, then the name of the program
and entry point can be provided in quotes instead.
Note: If the logic required to do a read is simply a formula, then it can be inserted
directly into the PROPERTY definition clause using an equals sign instead of GET; e.g,
PROPERTY ExtendedAmount = Quantity*Price
Specify the SET label to intercept all of the property updates. With SET in place, the
system calls the logic whenever the property is being updated and passes it the
value being set; e.g.,
PROPERTY Quantity SET ChgQty