skip to main content
OpenEdge Getting Started: Progress OpenEdge Studio
Assembling the Order Tracking System : Building the Customer section
 
Building the Customer section
The Customer section of the SportsPro Order Tracking System contains a SmartDataObject (SDO) for querying customer information, a SmartDataViewer (SDV) for viewing customer information, and buttons to launch the Find Customer and Customer Maintenance modules. When you are finished with this section of the tutorial, your window should look something like the following:
Task list and short procedure
To reach this point, you must know how to perform the following tasks:
1. Add a prebuilt SDO
2. Add a prebuilt SDV
3. Link an SDV to an SDO
4. Create and resize a button
5. Enhance a button with a ToolTip, a Help ID, and an image
6. Link a Help file to a window
7. Code a launch trigger for a button using the Section Editor
The following short procedure outlines how to complete these tasks
To build the Customer section:
1. Add a prebuilt SDO, dcust.w, to the Customer section. See the “Adding an SDO” section to review this procedure.
2. Add a prebuilt SDV, vcust.w, to the Customer section. See the “Adding an SDV” section to review this procedure.
3. Create a Data SmartLink from the SDO to the SDV. See Step 3 in the “Adding an SDV” section to review this procedure.
4. Create an Update SmartLink from the SDV to the SDO. See Step 4 in the “Adding an SDV” section to review this procedure.
5. Create two buttons with the following properties:
 
Object
Left
Height
Width
ToolTip
Help ID
Image
BUTTON-1
14
2.38
10
Find Customer
1
Findcust.jpg
BUTTON-2
14
2.38
10
Maintain Customer
2
mntcust.jpg
Note: The image files are stored in the images subdirectory of your working directory.
See the “Creating and positioning the buttons” section and the “Adding ToolTips, help IDs, and images to the buttons” section to review this procedure.
6. Link a help file to your window. See the “Adding online help to the window” section to review this procedure.
7. Write CHOOSE event triggers for the buttons in the Section Editor. See the “Coding event triggers for the buttons” section to review this procedure.
Detailed Customer section procedure
The following sections lead you through assembling the Customer section in more detail.
Adding an SDO
The first SmartObject added in most applications is the SDO that acts as a data source for the rest of the application’s SmartObjects.
To add an SDO:
1. Click the SDO icon in the Object Palette. The Choose SmartDataObject dialog box appears:
2. Select dcust.w and choose OK.
3. Move the pointer over the Customer section. Note that your pointer resembles the SDO icon.
4. Click once in the Customer section. You do not need to establish an exact position for an SDO because it is invisible when the application is running. The new SDO appears in the Customer section:
Adding an SDV
Next, you need to add an SDV. The SDV displays the customer information retrieved by the SDO.
To add an SDV:
1. Click the SDV icon in the Object Palette. The Choose SmartDataViewer dialog box appears:
2. Select vcust.w and click OK.
3. Click once in the Customer section. Note that the pointer now resembles the SDV icon. The Progress Advisor notifies you that the SDV instance, h_vcust, should be a data target for another SmartObject, and offers to create a Data SmartLink from the SDO instance, h_dcust:
Note: The Progress Advisor refers to SmartObjects with an h_ prefix to indicate a handle. A handle refers to an instance of a SmartObject in memory. For example, vcust is referred to by its handle, h_vcust.
4. Select the radio button to create the SmartLink and choose OK. The Progress Advisor notifies you that the SDV instance, h_vcust, should be an Update Source for some other SmartObject, and offers to create an Update SmartLink to the SDO instance, h_dcust:
5. Select the radio button to create the SmartLink and click OK. The SDV, vcust, appears in the Customer section.
6. Position the SDV within the Customer section, aligning it on the right edge of the design window, as shown in the following figure:
7. Double‑click the SDV to open its property sheet:
8. Click the SmartLinks button to view the SmartLinks dialog box. It shows a Data SmartLink from h_dcust to h_vcust and an Update SmartLink from h_vcust to h_dcust:
You can check the SmartLinks between your objects with this dialog. You can add, modify, and remove SmartLinks as needed. This allows you to alter how information flows between the SmartObjects in your application.
9. Close the open dialog box boxes and save your work.
Your next task is to add two buttons to the Customer section, complete with ToolTips, images, and help text.
Creating and positioning the buttons
The first step in adding buttons to your application is to create and position them.
To create and position the buttons:
1. Double‑click the Button icon in the Object Palette.
2. Click in the Customer section in two places to add two buttons, as shown. You do not need to position the buttons exactly. You will use the Properties Window to specify precise settings later. The main window should look something like the following:
3. Click the Pointer icon and, holding down the CTRL key, select both buttons.
4. Choose WindowProperties Window from the AppBuilder menu. The Properties Window, which enables quickly setting common attributes in many objects at once, appears:
5. Double‑click the Geometry row to expand its options:
Note: In this Properties Window, you can only change one value at a time. Select a row, type a value in the fill-in field next to the check-mark button, and then choose the check-mark to commit the change.
6. Set the following attributes for the buttons:
 
Attribute
Value
Left
14
Height
2.38
Width
10
When you finish, the window should look like the following:
7. Close the Properties Window and manually adjust the buttons’ vertical positions to resemble the following figure:
Adding ToolTips, help IDs, and images to the buttons
After creating and positioning the buttons, you are ready to add a ToolTip, a Help ID, and an image to each button.
To add ToolTips, Help IDs, and images to the buttons:
1. Open the property sheet for BUTTON-1 and set the following properties:
 
Property
Value
Tooltip
Find Customer
Help ID
1
2. Click the Up button in the Images section. The Choose Image dialog box appears.
3. Select Findcust.jpg from <wrk>\images, where <wrk> is your OpenEdge working directory. The button’s property sheet now looks like this:
4. Repeat the procedure for BUTTON-2, setting the following properties:
 
Property
Value
Tooltip
Maintain Customer
Help ID
2
Up Image
mntcust.jpg
When you finish, your window should appear as follows:
Adding online help to the window
Now that you have added Help IDs, you can link a context‑sensitive help file to your application. Help files are added to the window. All of the simple objects on that window reference the same context‑sensitive help.
To add a context-sensitive help file:
1. Click the List Object icon on the AppBuilder toolbar. The List Objects dialog box appears:
2. Select wWin from the Name list to select the window object.
3. Click the Object Properties icon in the AppBuilder toolbar to open the window’s property sheet:
4. Select the Context Help toggle-box to activate context sensitive help.
5. Type sports2000.hlp in the Help File field and choose OK.
6. Close the List Objects dialog box and save your window.
Coding event triggers for the buttons
Your next step is to add code to the buttons. When the user clicks on either button, a CHOOSE event occurs. Using the Section Editor, you can quickly add code to launch the appropriate module when each CHOOSE event occurs.
To add the trigger code to the buttons:
1. Select BUTTON-1 and click the Edit Code icon in the AppBuilder toolbar. The Section Editor appears:
2. Between the DO and END statements, add the following code:
 
RUN wfndcust.w  (h_dcust).
Note: This statement passes the handle for the dcust SDO to the module you are starting. As a result, the new module opens on the same customer record. Because the new module does not have an internal data source, it cannot run on its own.
3. Select BUTTON-2 in the combo box of objects:
4. Between the DO and END statements, add the following code:
 
 RUN wmntcust.w (h_dcust).
5. Choose FileClose Window to save the new code and return to the workspace.
Note: If you do not want to save code that you entered in the Section Editor, you must use the EditUndo menu options.
6. Save your work.
Now that you have built the Customer section of the SmartWindow, you can add SmartObjects to the Order section.