Using the DWObject variable in PowerBuilder
A PowerBuilder DWObject object is an object that exists within
a DataWindow object. Each column, computed field, text control,
or drawing control is a DWObject.
A DWObject reference allows you to refer directly to controls
within a DataWindow.
You can use a DWObject variable to simplify DataWindow property
and data expressions. A DWObject variable takes the place of several
elements of the control’s dot notation.
The following syntaxes and examples show how using a DWObject
variable affects property and data expressions.
Property expressions
The simple syntax for a property expression is:
1 |
dwcontrol.Object.<span>dwcontrolname</span>.<span>property</span> |
You can use a DWObject variable to refer to dwcontrolname.
If the code declares a DWObject variable and assigns the control
within the DataWindow to the variable, using syntax like this:
1 |
DWObject <span>dwobjectvar</span> |
1 |
<span>dwobjectvar</span> = <span>dwcontrol</span>.Object.<span>dwcontrolname</span> |
the syntax of the expression itself becomes:
1 |
<span>dwobjectvar</span>.<span>property</span> |
For example, if the DataWindow had a column named empname,
a text control named t_emplabel, and a computed field named
cf_average, you could make the following assignments:
1 |
DWObject dwo_column, dwo_text, dwo_compute |
1 |
dwo_column = dw_1.Object.empname |
1 |
dwo_text = dw_1.Object.t_emplabel |
1 |
dwo_compute = dw_1.Object.cf_average |
Data expressions
You can use a DWObject variable to refer to a column in a
data expression. For example, this syntax gets data for a single
row and column:
1 |
<span>dwcontrol</span>.Object.<span>columnname</span> {.<span>buffer</span> } {.<span>datasource</span> } [ <span>rownum</span> ] |
If the code declares a DWObject variable and assigns the control
within the DataWindow to the variable, using syntax like this:
1 |
DWObject <span>dwobjectvar</span> |
1 |
<span>dwobjectvar</span> = <span>dwcontrol</span>.Object.<span>columnname</span> |
The syntax of the expression itself becomes:
1 |
<span>dwobjectvar</span>. {.<span>buffer</span> } {.<span>datasource</span> } [<span> rownum </span>] |