Accessing the properties of a DataWindow object

About DataWindow object properties

DataWindow object properties store the information that controls the behavior of a DataWindow object. They are not properties of the DataWindow control, but of the DataWindow object displayed in the control. The DataWindow object is itself made up of individual controls—column, text, graph, and drawing controls—that have DataWindow object properties.

You establish initial values for DataWindow object properties in the DataWindow painter. You can also get and set property values during execution in your code.

You can access the properties of a DataWindow object by using the Describe and Modify methods or DataWindow property expressions. Which you use depends on the type of error checking you want to provide and on whether you know the names of the controls within the DataWindow object and properties you want to access when the script is compiled.

Note that in the Web ActiveX, only the Describe and Modify methods (not property expressions) are supported.

For guidelines on deciding which method to use and for lists and descriptions of DataWindow object properties, see the DataWindow Reference.

Using methods to access object properties

You can use the following methods to work with the properties of a DataWindow object:

PowerBuilder For example, the following statements assign the value of the Border property for the empname column to a string variable:

string ls_border
ls_border = dw_1.Describe("empname.Border")

The following statement changes the value of the Border property for the empname column to 1:

dw_emp.Modify("empname.Border=1")

Web ActiveX The JavaScript code is nearly identical to PowerScript. These statements get the value of the Border property for the empname column:

string ls_border
ls_border = dw_1.Describe("empname.Border");

The following statement changes the value of the Border property for the empname column to 1:

dw_emp.Modify("empname.Border=1");

NoteAbout dynamic DataWindow objects Using Describe and Modify, you can provide an interface through which application users can alter the DataWindow object during execution. For example, you can change the appearance of a DataWindow object or allow an application user to create ad hoc reports. For more information, see Chapter 3, “Dynamically Changing DataWindow Objects.”

Using expressions

DataWindow property expressions provide access to properties with fewer nested strings. In PowerBuilder, you can handle problems with incorrect object and property names in the Error event:

PowerBuilder Use the Object property and dot notation. For example:

integer li_border
li_border = Integer(dw_1.Object.empname.Border)
dw_1.Object.empname.Border = 1

For reference material on the available variations for property expressions, see the DataWindow Reference.