Inside a WITH block, you may assign values to existing properties only. Therefore, you are free to edit the values assigned to any of the properties in the class constructor, or add assignments to the objects’ stock properties.

Most properties must be of a particular data type. For example, pageNo is a number and sql is a string. If you change the property, you must maintain the correct type.

One notable exception is the value property. If a component is dataLinked to a field, the type of that field determines the type of the value. But if the component is not dataLinked, its type can be any of the simple data types. In the Inspector, you can use the Type button to select the type of the value you’re assigning to the property if the property can accept multiple types.

The Form designer leans toward literals as opposed to expressions. For example, suppose you want a Text component to default to the current date. You could edit the .WFM file so that the assignment reads:

value = date( )

That would work fine until the next time you edit the form in the Form designer. The expression gets evaluated when the form is loaded so that the value property has an actual date. Then that date gets saved to the .WFM file which causes the date that you last edited the form to be hard-coded into the form.

The simplest way to solve the problem is to set the value property programmatically, which puts it outside the reach of the Form designer. The most convenient place is the component’s onOpen event. A simple codeblock like this will do it:

{;this.value = date( )}

When the form is run, the form’s onOpen event and each component’s onOpen event, if any, is called in turn. This codeblock updates the value to the current date. The Form designer knows that a codeblock is attached to the onOpen event, and reads and writes it, but it doesn’t bother with what’s inside it, and doesn’t change it.