Description
Obtains the DWObject of an object in the DataWindow control or DataStore object.
Applies to
Syntax
PowerBuilder
dwObject dwcontrol.getdwobject ( readonly string name )
|
Argument |
Description |
|---|---|
|
dwcontrol |
A reference to a DataWindow control or DataStore. |
|
name |
The name of the object which you want to obtain. |
Return value
Returns a copy of DWObject of the object (the copy should be
destroyed through the Destroy method).
If any argument value is null, the method returns null. If the specified object does not exist in DataWindow, the method returns null.
Usage
This method can obtain the DWObject of the following objects within a DataWindow or DataStore:
-
Data columns
-
Computed fields
-
Controls
Examples
The following example gets the button's DWObject and triggers the DataWindow buttonclicked event:
dwobject ldwo_obj
string ls_dwobj
long ll_row,ll_actionreturn
ls_dwobj ="b_1"
ll_row =1
ll_actionreturn=1
ldwo_obj = dw_1.getdwobject(ls_dwobj)
dw_1.event buttonclicked(ll_row,ll_actionreturn,ldwo_obj)
destroy ldwo_obj
//scritps in the buttonclicked event
//if(dwo.name="b_1") then
//action
//elseif (dwo.name="b_2") then
//...
//else
//...
//end if
The following example gets the column's DWObject and the column data in the primary buffer, and assigns data to an array:
//Equivalent to this hard code: dw_1.object.emp_id.primary[]
any la_datalist[]
dwobject ldwo_obj
ldwo_obj= dw_1.getdwobject('emp_id')
la_datalist[] = ldwo_obj.primary[]
destroy ldwo_obj
The following example assigns data of selected rows to an array directly through dot notation:
long ll_idlist[]
ll_idlist[] = dw_1.getdwobject('emp_id').selected
The following example gets the coltype property of the column object according to the column name:
string ls_columntype
ls_columntype = dw_1.getdwobject('emp_name').coltype //previously used dw_1.Describe("")


