What you can do with DataWindow object properties

The DataWindow object defines the way data is displayed in a DataWindow control. It contains controls that represent the columns, text labels, computed fields, and images.

The properties of the DataWindow object and its controls store the information that specifies the behavior of the DataWindow object. They are not properties of the DataWindow control, but of the DataWindow object displayed in the control.

NoteTerminology When you are programming for DataWindows, there are several types of expressions involved.

A DataWindow expression is an expression assigned as a value to a DataWindow property and is evaluated by the DataWindow engine. The expression can refer to column data and can have a different value for each row in the DataWindow.

A DataWindow property expression is an expression in your code that gets or sets the value of a DataWindow property. Its effects are equivalent to what the Describe and Modify methods do.

A DataWindow data expression is an expression in your code that gets or sets data in the DataWindow. Its effects are similar to what the SetItem and several GetItem methods do.

Types of values

Property values can be constants or can be DataWindow expressions. DataWindow expressions allow the property value to be based on other conditions in the DataWindow, including data values. Conditional expressions based on data can give the property a different value for each row.

Getting and setting values

You establish initial values for properties in the DataWindow painter. You can also get and set property values at runtime in code.

There are several techniques for accessing property values. A particular property might be accessible by a subset of those techniques. For example, some properties are read-only at runtime, some can be set only at execution, and some accept only constants (not DataWindow expressions) as values.

For a complete list of properties and the ways you can access each one, see Chapter 3, “DataWindow Object Properties.”

Examples: ways of setting the Border property

This table lists the ways you can access a property, using the Border property as an example:

Table 5-1: Ways to access and change DataWindow object properties

What you can do with properties

How to do it, using the Border property as an example

What happens

Set the initial value of the property in the workspace

Property sheet, General tab, Border box

The Border property takes on the value you set unconditionally. In the Preview view and at runtime, the control has the border you indicated in the workspace unless you set the Border property again in some way.

Specify the value of the property at runtime based on an expression defined for the control in the workspace

Property sheet, General tab, Border box, Expression button

In Preview and at runtime, the border changes as specified in the expression, which overrides the setting on the property sheet.

For example, an expression can give the Salary column value a ShadowBox border when the salary exceeds $70,000.

To see the effect in the Preview view, you might need to close Preview and reopen it.

Get the value of the property at runtime in code

Property expression for the Border property or Describe method

Both the expression and the Describe method return the value of the Border property for the specified control.

Change the value of the property at runtime in code

Property expression for the Border property or Modify method

At runtime, the value of the property changes when the code executes. For example, you could code Modify in the Clicked event and change the border of the control the user clicked.

Set the initial value of the property at runtime in code for a DataWindow being created

SyntaxFromSQL method

When SyntaxFromSQL executes, the border value of all columns is set in the generated syntax.

PowerBuilder SyntaxFromSQL is a method of the Transaction object and is described in the PowerScript Reference.