| Home | Previous Lesson: Global Function f_copyrecord Next Lesson: Code For The DataWindow Control |
This is declared at the user object level. Go to the Script painter, display popup menu and select 'Go To > Functions' menu option. Declare the function as shown below and set the return value to none.
|
Name |
Type |
Pass By |
|
As_heading_left |
String |
Read-Only |
|
As_heading_right |
String |
Read-Only |
|
As_dwo |
string |
Read-Only |
|
Atr_tran1 |
Transaction |
Ref |
The difference between f_copyrecord and uf_initialize function is that, the former one is Global (available in all objects in the application) and has Public access level. You can't define access level to a global function, it is always Public. On the other hand, you have the freedom of declaring the access level to functions defined at the (User) object level.
We declared this function public because, we want all objects to use this function. This function allows initialization of the user object, which makes the user object more re-usable.
// Object: uo_shuffle_rows_between_2_dws
// Function: uf_initialize()
st_left_heading.text = As_heading_left
st_right_heading.text = As_heading_right
dw_left.dataobject = As_dwo
dw_right.dataobject = As_dwo
dw_left.SetTransObject( Atr_tran1 )
dw_right.SetTransObject( Atr_tran1 )
dw_left.retrieve()
Since this is a reusable object, we neither specified any text for the StaticText controls nor assigned DataWindow objects to dw_left and dw_right DataWindow controls. To set these controls, we write an initialization function. The function passes the transaction object as a parameter, which makes it flexible, if you are using more than one transaction in an application.
| Home | Previous Lesson: Global Function f_copyrecord Next Lesson: Code For The DataWindow Control |