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.
For guidelines on deciding which method to use and for lists and
descriptions of DataWindow object properties, see Accessing Data in Code in DataWindow Reference.
Using methods to access object
properties
You can use the following methods to work with the properties of a
DataWindow object:
-
Describe – Reports the values of properties of a DataWindow
object and controls within the DataWindow object -
Modify – Modifies a DataWindow object by specifying a list of
instructions that change the DataWindow object’s definition
PowerBuilder
For example, the following statements assign the value of the Border
property for the empname column to a string variable:
|
1 2 |
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:
|
1 |
dw_emp.Modify("empname.Border=1") |
About 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 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:
|
1 2 3 |
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 the section called “PowerBuilder:
DataWindow property expressions” in DataWindow Reference.