skip to main content
OpenEdge Getting Started: Progress OpenEdge Studio
Assembling the Order Tracking System : Building the Order section
 
Building the Order section
The Order section contains SmartObjects for querying and viewing order information: SDOs, an SDV, Object Component Extension (OCX) controls (also known as ActiveX controls), and buttons for launching associated 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. Link SDOs together and map their foreign fields
3. Add a prebuilt SDV
4. Link an SDV to an SDO
5. Create and resize a button
6. Enhance a button with a ToolTip, a Help ID, and an image
7. Code a launch trigger for a button using the Section Editor
8. Create and resize an OCX control
9. Code navigation triggers for an OCX control using the Section Editor
The following short procedure outlines how to complete these tasks.
To build the Order section:
1. Add a prebuilt SDO, dorder.w, to the Order section. See the “Adding an SDO for orders” section to review this procedure.
2. Create a Data SmartLink from dcust.w to dorder.w. See Step 3 in the “Adding an SDO for orders” section to review this procedure.
3. Map the Customer.CustNum field to the Order.CustNum field. See Step 4 in the “Adding an SDO for orders” section to review this procedure.
4. Add a prebuilt SDO, dordlne.w, to the Order section. See the “Adding an SDO for order lines” section to review this procedure.
5. Create a Data SmartLink from dorder.w to dordlne.w. See Step 3 in the “Adding an SDO for order lines” section to review this procedure.
6. Map the Order.Ordernum field to the OrderLine.Ordernum field. See Step 5 in the “Adding an SDO for order lines” section to review this procedure.
7. Add a prebuilt SDV, vorder.w, to the Order Section. See the “Adding an SDV” section to review this procedure.
8. Create a Data SmartLink from dorder.w to vorder.w. See Step 3 in the “Adding an SDV” section to review this procedure.
9. Create an Update SmartLink from vorder.w to dorder.w. See Step 4 in the “Adding an SDV” section to review this procedure.
10. Add three buttons with the following properties:
 
Object
Left
Height
Width
ToolTip
Help ID
Image
BUTTON-3
14
2.38
10
Place New Order
3
crtord.jpg
BUTTON-4
14
2.38
10
Find Order
4
findord.jpg
BUTTON-5
14
2.38
10
Maintain Order
5
mainord.jpg
See the “Creating and positioning the buttons” section and the “Adding ToolTips, help IDs, and images to the buttons” section to review this procedure.
11. Write CHOOSE event triggers for the buttons in the Section Editor. See the “Coding event triggers for the Order buttons” section to review this procedure.
12. Add and position two control frames, based on the Crescent Spin Control OCX. See the “Adding OCX controls” section to review this procedure.
13. Assign the OCX control frames the following properties:
 
Property
Value
Height
1.52
Width
9.0
Style
3D Horizontal
ArrowColor
dark blue
See the “Changing the appearance of the OCX controls” section to review this procedure.
14. Create the following Text labels:
 
Object
Label
Color
CtrlFrame
Prev/Next
1
CtrlFrame-2
First/Last
1
See Step 7 in the “Changing the appearance of the OCX controls” section to review this procedure.
15. Place a rectangle around each OCX control and its text label. See Step 8 in the “Changing the appearance of the OCX controls” section to review this procedure.
16. Add OCX.SpinDown and OCX.SpinUp triggers for the control frames. See the “Coding the Prev/Next spin box to fetch the previous record” section and the “Coding the First/Last spin box to fetch the first and last records” section to review this procedure.
17. Run and check your application. See the “Viewing the window” section to review this procedure.
Detailed Order section procedure
The sections that follow describe building the Order section in detail.
Adding an SDO for orders
As in the Customer section, the SDOs are the first objects to add to the Order section. The Order section needs SDOs that query the database for orders and the order lines that make up that order.
To add an Order SDO:
1. Click the SDO icon in the Object Palette to open the Choose SmartDataObject dialog box.
2. Select dorder.w and click OK.
3. Click once in the Order section. You do not need to position a SDO precisely, since it is invisible when an application is running. The Progress Advisor notifies you that the SDO instance, h_dorder, can be a Data Target for some other SmartObject, and offers to add a Data SmartLink from the SDO instance, h_dcust.
4. Select the radio button to create the SmartLink and click OK. The Progress Advisor notifies you that h_dorder and h_dcust are both Query Objects, and asks whether you want to specify foreign fields:
5. Select the radio button to choose foreign fields and click OK. The Multi‑Field Mapping dialog box appears.
6. Select CustNum in the Source and Order.CustNum in the Target list:
7. Click Map. The field pair is displayed in the Mapped Fields field.
8. Click OK. The new SDO, dorder.w, appears in the main window.
Adding an SDO for order lines
You are now going to add another SDO, dordlne, to the Order section.
To add an Order Lines SDO:
1. Click the SDO icon in the Object Palette to open the Choose SmartDataObject dialog box.
2. Select dordlne.w and click OK.
3. Place the new SDO under the other SDO. This is only for convenience, their positions do not affect how they operate. The Progress Advisor notifies you that the SDO instance, h_dordlne, can be a Data Target for some other SmartObject, and offers to add a Data SmartLink from either of the other SDO instances:
4. Select the radio button to create the SmartLink to h_dorder and click OK. The Progress Advisor notifies you that h_dordlne and h_dorder are both Query Objects and asks if you want to choose foreign fields.
5. Select the radio button to select foreign fields and then click OK. The Multi‑Field Mapping dialog box appears.
6. Select Ordernum in the Source list and OrderLine.Ordernum in the Target list.
7. Click Map. The field pair is displayed in the Mapped Fields field.
8. Click OK. The new SDO, dordlne, appears in the design window:
9. Save your work.
Adding an SDV
The next object to add is an SDV that displays the order information.
To add an SDV for displaying order information:
1. Click the SDV icon in the Object Palette to open the Choose SmartDataViewer dialog box.
2. Select vorder.w and click OK.
3. Click within the Order section to add the SDV. The Progress Advisor notifies you that SDV instance, h_vorder, should be a Data Target for some other SmartObject, and offers to create a Data SmartLink from the SDO instance, h_dorder.
4. Select the radio button to create the SmartLink and choose OK. The Progress Advisor notifies you that the SDV instance, h_vorder, should be an Update source for some other SmartObject, and offers to add an Update SmartLink to the SDO instance, h_dorder.
5. Select the radio button to create the SmartLink and click OK. The SDV appears in the main window.
6. Position the SDV near the top of the Order section and aligned on the right edge. Your window should look something like the following:
Adding buttons to the Order section
You need to add buttons to the Order section, as you did to the Customer section. Follow the procedures in the “Creating and positioning the buttons” section and the “Adding ToolTips, help IDs, and images to the buttons” section to add and customize the three buttons to the Order section.
To customize the buttons, use the values in the following table:
 
Object
Left
Height
Width
ToolTip
Help ID
Image
BUTTON-3
14
2.38
10
Place New Order
3
crtord.jpg
BUTTON-4
14
2.38
10
Find Order
4
findord.jpg
BUTTON-5
14
2.38
10
Maintain Order
5
mainord.jpg
Note: You do not need to add a Help file for the Order section buttons. The Help file you added while building the Customer section controls the Help for the entire window. It applies to all sections of the window.
When you finish, your window should look like the following:
Coding event triggers for the Order buttons
You need to add CHOOSE event triggers to the buttons, as you did in the Customer section. Follow the procedures in the “Coding event triggers for the buttons” section.
Using the Section Editor, add the following code to the CHOOSE events of the buttons in this section:
 
Button
Code
BUTTON-3
RUN wmntord.w (h_dcust, h_dorder, h_dordlne).
BUTTON-4
RUN wfndord2.w(h_dorder).
BUTTON-5
RUN wmntord.w (h_dcust, h_dorder, h_dordlne).
The remaining objects to add to the Order section are two Object Component Extension (OCX) controls, also known as ActiveX controls.
Adding OCX controls
In this section, you add Object Component Extension (OCX) controls to your window. An OCX (also called an ActiveX control) is a predefined object widget that you include in a control‑frame to add prepackaged functionality to your applications.
ActiveX objects are Common Object Model (COM) objects that provide a form of interprocess communication with other Windows applications along the Microsoft ActiveX specifications. For more information about ActiveX Automation, see OpenEdge Development: Programming Interfaces.
The OpenEdge Studio ships with three licensed OCX controls:
*Crescent Spin Control, csspin32.ocx, a spin box
*CS ComboBox Control, cscomb32.ocx, a combo box
*Progress Timer Control, pstimer.ocx, an object that allows you to determine the length of time used by a process
With the AppBuilder, you can integrate third‑party objects, like OCXs, into your applications in the same way you build SmartObjects. For example, in this section, you choose the OCX spin box from the Object Palette, position and resize it visually in the window, and write user‑interface triggers for it using the Section Editor. For more detailed information about ActiveX (OCX controls) and the AppBuilder, see OpenEdge Development: AppBuilder.
Selecting an OCX object
In this section, you add two OCX spin box controls to the Order section. These OCX controls are used to navigate through the records in the SDO, dorder, which sends the order information to the SDV, vorder, for viewing.
To add OCX controls to the Order section:
1. Double-click the OCX icon in the Object Palette. The Choose Control dialog box appears:
Note: If you installed other OCX controls, they should also appear in the Available Controls list.
2. Select the Crescent Spin Control in the Available Controls list. When you select an OCX control, the location and control name appear at the bottom of the Choose Control dialog box.
3. Click OK to return to your design window.
4. Add two spin boxes to the Order section. The spin boxes appear with their default dimensions. Your window should appear similar to the following:
Changing the appearance of the OCX controls
The OCX spin boxes are too large and oriented in the wrong direction. You need to resize the OCX spin boxes, change their orientation, and add text labels and borders.
To resize the OCX spin boxes and change their orientation:
1. Use the WindowProperties Window option in the AppBuilder menu to set the control frames’ Heights to 1.52 and their Widths to 9.0.
See the “Creating and positioning the buttons” section for information on using the Properties Window.
2. Double‑click the left spin box to open the Property Editor dialog box:
3. Select the Style property and set it to Style 3 - 3D Horizontal.
4. Select the ArrowColor property and set it to dark blue.
5. Close the property sheet.
6. Repeat Step 2 through Step 5 for the right spin box. Your window should now look something like the following:
7. Use the Text icon in the Object Palette to add the colored text labels, Prev/Next, below the left spin box and First/Last below the right spin box. See the “Adding text labels to the sections” section to review this procedure.
8. Use the Rectangle icon in the Object Palette to add a rectangle around each spin box:
Coding the Prev/Next spin box to fetch the previous record
You need to code the OCX controls in your window to navigate through the Order records. First, you will code the Prev/Next spin box to fetch the previous record.
To add trigger code to fetch the previous record:
1. Select the Prev/Next spin box and open the Section Editor.
2. Click the New button to open the Choose Event dialog box:
3. Select OCX.SpinDown from the Common OCX Events list. The Section Editor now displays the new code section:
4. Position the cursor between the Header comments and the END PROCEDURE statement.
5. Click the Insert Call button to open the Insert Procedure Call dialog box:
6. Select h_dorder from the Procedure Object drop‑down list.
7. Select the Procedures radio button in the Entries in Object section, and select fetchPrev. The Code to Insert field shows a preview of the code for this procedure call:
8. Click OK. The new code appears in the Section Editor:
Coding the Prev/Next spin box to fetch the next record
Now, you need to code the Prev/Next spin box to fetch the next record.
To add trigger code to fetch the next record:
1. Click New in the Section Editor to open the Choose Event dialog box.
2. Select OCX.SpinUp in the Common OCX Events list.
3. Position the cursor between the Header comments and the END PROCEDURE statement.
4. Click the Insert Call button to open the Insert Procedure Call dialog box.
5. Select h_dorder from the Procedure Object drop‑down list.
6. Select the Procedures radio button in the Entries in Object section.
7. Select fetchNext and click OK. The new trigger code appears in the Section Editor.
8. Choose FileClose Window to save the new code and close the Section Editor.
Coding the First/Last spin box to fetch the first and last records
The second spin box fetches the first or last record in the Order SDO. The only thing that differs from what you did for the Prev/Next spin box is the procedure called by the spin events. First, you add the code to fetch the first record.
To add trigger code to fetch the first record, repeat the procedure in the “Coding the Prev/Next spin box to fetch the previous record” section. Use the fetchFirst procedure, instead of the fetchPrev procedure.
Now, you add the code to fetch the last record.
To add trigger code to fetch the last record, repeat the procedure in “Coding the Prev/Next spin box to fetch the next record” section. Use the fetchLast procedure, instead of the fetchNext procedure.
You can now save your window and have a look at how it runs so far.
Viewing the window
You have now completed assembling the Customer and Order sections of the application’s main window. If you want to view and test the partially assembled application, run the application to view the window at this point in the assembly. Before you run the application, save your work.
To view the partially assembled window:
1. Click the Run icon on the AppBuilder toolbar. Your window should appear as it would in a running application. The main window of the sample application should look like the following:
2. Hold your pointer over a button to view the ToolTip.
3. Click the context sensitive help button (?) in the upper‑right corner of the window and then click a button to see the context sensitive help.
4. Select one of the buttons to launch another module.
5. Choose the Stop icon on the AppBuilder toolbar to return to the main window.
Now you can proceed to building the Order Line section.