:= Operator

Language Items List

Definition:

A variation of the assignment = Operator, called the "Deep-Set" operator, which uses the colon (:) character to indicate that the extended assignment is intended. The assignment operator is used to assign values to variables or properties.

Syntax:

Syntax Description


expression Value assigned to the variable. It can be any string or numeric expression.

Details:

The difference between the regular assignment operator (
= Operator) and the deep-set assignment (:= Operator) is that deep set not only sets the assigned property, but the properties of all objects inheriting that property as well. For example, suppose you add a string property called MyProp to an object called MyObject. Then you make some copies of MyObject. The current value of MyProp will be copied to each of the copied objects as the initial value for that property. If you want to keep this property in sync with the original definer, use the := Operator to perform the assignment as shown below:

MyObject.MyProp := newValue

As long as the objects that inherit the property still have the same value as the original definer (MyObject), the change will also be propagated to them.

For the property assignment to be propagated, the following conditions must exist:

images/Phx90000.gif The assignment must occur on the original definer of the property (the owner).

images/Phx90000.gif The objects that inherit the property must still have the same value as that of the original property prior to the deep set. That is, the properties must already be in sync to stay in sync.


Note: This is the mechanism the Property Editor uses to set properties. When a new property value is set through the Property Editor, this value is propagated to each object that copies (or inherits) that property and whose value is the same.