You can set or change properties at design time or programmatically.
|Some properties are evaluated at design time, so any memory variables or arrays used in expressions for these properties must be in scope at design time. Properties that are read-only at design time, such as the Class property of an object, are displayed in italics in the properties list of the Properties window.|
To set or edit the value for a property
Click an object on the form.
From the properties list in the Properties window, select a property.
In the property settings box, type or choose the desired setting for the selected property.
You can also select an object from the object box in the Properties window.
If the property requires a character value, you do not have to include the value in quotation marks. For example, if you want the caption of a form to display as Customer, type
Customer in the property settings box. However, if you want the caption to display as "Customer" with quotation marks (""), type
"Customer" in the property settings box.
Setting Properties to Expressions
You can set certain properties to the results of expressions or functions in the Properties window. Visual FoxPro evaluates the expression for a property when you enter it in the Properties window and when the object is initialized at design or run time. Once the object is created, the property setting does not change until you or the user explicitly changes it.
|If you set a property to the result of a user-defined function, Visual FoxPro evaluates the function when you set the property, or when you modify or run the form. If an error exists in the user-defined function, you might not be able to open your form.|
To set a property to an expression
From the properties list, select the property for which you want to enter an expression.
In the property settings box, type an equal sign (=) followed by the expression.
For example, you can indicate the currently active table when the form runs by selecting the Caption property of the form and typing
=ALIAS(В ) in the property settings box.
You can also specify expressions for properties by using the Expression Builder Dialog Box. To open the Expression Builder, select the desired property and click the Function button in the Properties window.
You can also set the property to the user-defined function in the Init event of the object as in the following example:
THIS.Caption = myfunction( )
However, if an error exists in the user-defined function, you will still be unable to run the form, but you can modify it.