Progress
ADM 2 Guide
Parameterizing SmartObject Instances as Variables
When you insert a SmartObject instance into a SmartContainer, you can specify a variable name for it by accessing its property sheet and activating the Parameterize As Variable toggle box. When you do this, you are prompted for a variable name to associate with the SmartObject. You can supply either a local CHARACTER variable or parameter that you define in the SmartContainer that you are building; this variable or parameter must be assigned the filename of the SmartObject procedure file to be run in place of the SmartObject. The SmartContainer uses the specified variable name at run time to get the name of the master procedure file. The SmartContainer uses this filename to instantiate the SmartObject instance; by programmatically changing the value of the variable, you can have it specify different SmartObject master filenames. When the SmartContainer instantiates the SmartObject, it uses the setting of the variable to choose a particular master procedure file.
With this technique, you can use the same SmartContainer to create many different application screens. Keep in mind that inside the SmartContainer you must define the variable and set it appropriately.
The following examples illustrate how to use Parameterize As Variable. Each example uses placeholder SmartObjects: SmartObjects that you place in a SmartWindow to allow linking them at design time in the AppBuilder. Specifically, each example uses a placeholder SmartDataObject and SmartDataViewer for the customer table, which you can replace at run time with any SmartDataObject and SmartDataViewer that can be linked with Data and Update SmartLinks. To do this, you set the variables to the object names for the replacement SmartDataObject and SmartDataViewer.
Using Parameterize As Variable with a Variable. To use Parameterize As Variable with a variable defined in a SmartContainer, follow these steps:
- Create a SmartWindow.
- Drop a placeholder SmartDataObject and a placeholder SmartDataViewer into the SmartWindow and link them with Data and Update SmartLinks.
- Select the SmartDataObject and open its property sheet (Tool
Property Sheet), then check the Parameterize As Variable option and enter cSDOName in the Variable fill-in field that appears.
- Select the SmartDataViewer and open its property sheet (Tool
Property Sheet), then check the Parameterize As Variable option and enter cSDVName in the Variable fill-in field that appears.
- Save the SmartWindow to a filename of your choice.
- In the Definitions section of the saved SmartWindow file, define variables for the SmartDataObject and SmartDataViewer that the SmartWindow will contain:
- In the SmartWindow’s main block, assign to these variables values that specify which SmartDataObject and SmartDataViewer are displayed in this SmartWindow at run time:
You must assign values to these variables in the main block so that they are set before the AppBuilder runs adm–create–objects to construct the SmartObjects that they specify.
Using Parameterize As Variable with Input Parameters. To use Parameterize As Variable with input parameters defined in a SmartContainer, follow these steps:
- Create a SmartWindow.
- Drop a placeholder SmartDataObject and a placeholder SmartDataViewer into the SmartWindow and link them with Data and Update SmartLinks.
- Select the SmartDataObject and open its property sheet (Tool
Property Sheet), then check the Parameterize As Variable option and enter pcSDOName in the Variable fill-in field that appears.
- Select the SmartDataViewer and open its property sheet (Tool
Property Sheet), then check the Parameterize As Variable option and enter pcSDVName in the Variable fill-in field that appears.
- Save the SmartWindow to a filename of your choice.
- In the Definitions section of the saved SmartWindow file, define variables for the SmartDataObject and SmartDataViewer that the SmartWindow will contain:
- When the SmartWindow is run, pass the SmartDataObject and SmartDataViewer names to the SmartWindow as parameters:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |