Modifying a DataWindow object

At runtime, you can modify the appearance and behavior of a DataWindow object by doing one of the following:

Changing property values

You can use the Modify method or a property expression to set property values. This lets you change settings that you ordinarily specify during development in the DataWindow painter.

Before changing a property, you might want to get the current value and save it in a variable, so you can restore the original value later. To obtain information about the current properties of a DataWindow object or a control in a DataWindow object, use the Describe method or a property expression.

Using expressions in property values

With some DataWindow properties, you can assign a value through an expression that the DataWindow evaluates at runtime, instead of having to assign a value directly. For example, the following statement displays a salary in red if it is less than $12,000, and in black otherwise:

dw_1.Modify("salary.Color &
		= '0 ~t if(salary <12000,255,0)' ")

For more information

The syntax is different for expressions in code versus expressions specified in the DataWindow painter. For the correct syntax and information about which properties can be assigned expressions, see the DataWindow Reference in the online Help.

Adding and deleting controls within the DataWindow object

You can also use the Modify method to:

Tool for easier coding of DataWindow syntax

Included with PocketBuilder is DW Syntax, a tool that makes it easy to build the correct syntax for property expressions, Describe, Modify, and SyntaxFromSQL statements. You click buttons to specify which properties of a DataWindow you want to use, and DW Syntax automatically builds the appropriate syntax, which you can copy and paste into your application code.

To access DW Syntax, select File>New and select the Tool tab.

Viewing DataWindow object properties in the Browser

You can use the Browser to get a list of DataWindow properties: on the DataWindow page, select a DataWindow object in the left pane and Properties in the right pane. To see the properties for a control in a DataWindow object, double-click the DataWindow object name, then select the control.