When you associate a DataWindow object with a control in a window, you are setting the initial value of the DataWindow control's DataObject property. At runtime, this tells your application to create an instance of the DataWindow object specified in the control's DataObject property and use it in the control.
At runtime, you change the DataWindow object associated with a DataWindow control by setting the DataObject property to one of the DataWindow objects built into the application.
Creating a DataWindow object at runtime You can also create a new DataWindow object at runtime and associate it with a control. For more information, see Chapter 10, “Dynamically Changing DataWindow Objects.”
To display the DataWindow object d_emp_hist from the library emp.pkl in the DataWindow control dw_emp, you can code:
dw_emp.DataObject = "d_emp_hist"
The DataWindow object d_emp_hist was created in the DataWindow painter and stored in a library on the application search path. The control dw_emp is contained in the window and is saved as part of the window definition.
When you change the DataWindow object at runtime, you may need to call setTrans or setTransObject again. For more information, see “Setting the transaction object for the DataWindow control”.
Preventing redrawing Use the SetRedraw method to turn off redrawing in order to avoid flicker and reduce redrawing time when you are making several changes to the properties of an object or control. Dynamically changing the DataWindow object at runtime implicitly turns redrawing on. To turn redrawing off again, call the SetRedraw method every time you change the DataWindow object:
dw_emp.DataObject = "d_emp_hist"
dw_emp.SetRedraw(FALSE)