Reusing a DataWindow object

You can reuse a DataWindow object by retrieving its syntax from the library it is stored in, then using the syntax to create a DataWindow object dynamically in a DataWindow control.

Here is a typical way to accomplish this in an application. Use:

  • The LibraryDirectory function to obtain a list of DataWindow objects and other library entries in the current library

  • A DropDownListBox to list the DataWindow objects in the library and then allow the user to select a DataWindow from the list

  • The LibraryExport function to export the selected DataWindow object syntax into a string variable

  • The Create method to use the DataWindow syntax to create the DataWindow object in the specified DataWindow control

  • The Describe method to get the current DataWindow object syntax, for example:

    string dwSyntax
    dwSyntax = dw_1.Describe("datawindow.syntax") 
  • The Modify method to allow the user to modify the DataWindow object

  • The LibraryImport function to save the user-modified DataWindow object in a library

For information about the PowerScript functions, see PowerScript Functions in PowerScript Reference. For information about the DataWindow methods Create, Describe, and Modify, see Methods for the DataWindow Control in DataWindow Reference.