Progress
Application Development
Environment — Getting Started


Detailed Order Section Procedure

The following sections describe building the Order section in detail.

Adding a SmartDataObject 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.

Follow these steps to add an SDO:

  1. Choose the SDO icon in the Object Palette to open the Choose SmartDataObject dialog box.
  2. Select dorder.w and choose OK.
  3. Click once in the Order section. You do not need to position a SmartDataObject precisely, since it is invisible when an application is running.
  4. The Progress Advisor opens, 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.

  5. Select the radio button to create the SmartLink and choose OK.
  6. The Progress Advisor opens, notifies you that h_dorder and h_dcust are both Query Objects, and asks whether you want to specify foreign fields:

  7. Select the radio button to choose foreign fields and choose OK.
  8. The Multi-Field Mapping dialog box opens.

  9. Map CustNum in the Source list to Order.CustNum in the Target list, as shown in the following figure:
  10. The new SmartDataObject, dorder.w, appears in the main window when you choose OK.

Adding a SmartDataObject For Order Lines

You are now going to add another SDO, dordlne, to the Order section.

Follow these steps to add the SDO:

  1. Choose the SDO icon in the Object Palette to open the Choose SmartDataObject dialog box.
  2. Select dordlne.w and choose OK.
  3. Position the pointer below the other SDO, dorder, and click once.
  4. NOTE: Because the SDO is invisible when the application runs, you do not need to position the SDO precisely.

    The Progress Advisor opens, 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:

  5. Choose the radio button to create the SmartLink and choose OK.
  6. The Progress Advisor opens, notifies you that h_dordlne and h_dorder are both Query Objects and asks if you want to choose foreign fields.

  7. Choose the radio button to select foreign fields and then choose OK.
  8. The Multi-Field Mapping dialog box opens.

  9. Map Ordernum in the Source list to OrderLine.Ordernum in the Target list.
  10. The new SmartDataObject, dordlne, appears in the design window when you choose OK:

  11. Save your work.
Adding a SmartDataViewer

The next object to add is an SDV for displaying order information.

Follow these steps to add an SDV:

  1. Choose the SDV icon in the Object Palette to open the Choose SmartDataViewer dialog box.
  2. Select vorder.w and choose OK.
  3. As you pass the pointer over the design window, the pointer resembles the SDV icon.

  4. Click within the Order section to add the SDV.
  5. The Progress Advisor opens, 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.

  6. Select the radio button to create the SmartLink and choose OK.
  7. The Progress Advisor opens, 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.

  8. Select the radio button to create the SmartLink and choose OK.
  9. Position the SmartDataViewer near the top of the Order section and align it on the right edge of the Order section. Your SmartWindow should look like the one in the following figure:
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 "Creating and Positioning the Buttons" and "Adding ToolTips, Help IDs, and Images To the Buttons" in the "Detailed Customer Section Procedure" section of this chapter to add and customize the three buttons to the Order section.

Use the values in the following table to customize the buttons:

Object
Column
Row
Height
Width
ToolTip
Help ID
Image
BUTTON-3
14
7.92
2.38
10
Place New Order
3
crtord.jpg 
BUTTON-4
14
10.54
2.38
10
Find Order
4
findord.jpg 
BUTTON-5
14
13.15
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 window:

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 "Coding Event Triggers For the Buttons" in the "Detailed Customer Section Procedure" section of this chapter.

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 Object Component Extensions

In this section, you add Object Component Extension (OCX) controls to the SportsPro Order Tracking System. An OCX (also called an ActiveX control) is a predefined object widget that you include in a control-frame to help develop 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 the Progress External Program Interfaces manual.

Progress ships with three licensed OCX controls:

You can select these OCX controls by:

For this exercise, use the OCX icon to add the controls.

The AppBuilder enables you to integrate third-party objects, such as OCXs, into your applications similar to the way you build SmartObjects. For example, for the OCX spin box you work with in this section, you choose it from the Object Palette, position and resize it visually in the SmartDataViewer window, and write user-interface triggers for it using the Code Section Editor. For more detailed information about ActiveX (OCX controls) and the AppBuilder, see the Progress AppBuilder Developer’s Guide .

In this section, you:

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.

Follow these steps to add OCX controls to the Order section:

  1. Choose the OCX icon in the Object Palette to open the Choose Control dialog box:
  2. NOTE: If you installed other OCX controls, they should also appear in the Available Controls list.

  3. Select the Crescent Spin Control and choose OK.
  4. When you select an OCX control, the location and control name appear at the bottom of the Choose Control dialog box.

  5. Add two spin boxes to the Order section.
  6. The spin boxes appear with their default dimensions. The Order section should appear similar to the following window:

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.

Follow these steps to resize the OCX spin boxes and change their orientation:

  1. Use the Window Properties Window option in the AppBuilder menu to set the control frames’ Heights to 1.52 and their Widths to 9.0.
  2. See "Creating and Positioning the Buttons" in the "Detailed Customer Section Procedure" section for information on using the Properties Window.

  3. Double-click the left spin box to open the Property Editor - CSSpin dialog box and scroll down to select the Style property:
  4. From the Style drop-down list, select 3-3D Horizontal.
  5. From the ArrowColor drop-down list, select a dark blue.
  6. Close the Property Editor dialog box.
  7. Double-click the right spin box and repeat the procedure from Step 2 for the right spin box.
  8. Your window should now look something like this:

  9. 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. To review this procedure, see "Adding Text Labels To the Sections" in the "Detailed Customer Section Procedure" section.
  10. Position the left spin box and label so that they are centered under the Order Status control and the right spin box and label so that they are centered under the Credit Card control.
  11. 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

Follow these steps to add trigger code to select the previous record value with the Prev/Next spin box:

  1. Select the Prev/Next spin box and open the Section Editor.
  2. Choose the New button in the Section Editor to open the Choose Event dialog box:
  3. Select OCX.SpinDown from the Common OCX Events list.
  4. The Section Editor now displays the new code section:

  5. Position the cursor below the comments section and above the END PROCEDURE statement.
  6. Choose the Insert Call button to open the Insert Procedure Call dialog box:
  7. Select h_dorder from the Procedure Object drop-down list.
  8. Select the Procedures radio button in the Entries in Object section, and select fetchPrev.
  9. The Code to Insert section shows a preview of the code for this procedure call:

  10. Choose OK. The new code appears in the Section Editor:
Coding the Prev/Next Spin Box To Fetch the Next Record

Follow these steps to add trigger code to select the next record value with the Prev/Next spin box:

  1. Choose 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 below the comments section and above the END PROCEDURE statement.
  4. Choose 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, and select fetchNext.
  7. Choose OK.
  8. The new trigger code appears in the Section Editor.

  9. In the Section Editor, choose File Close Window to save the new code and close the window.
Coding the First/Last Spin Box To Fetch the First Record

Follow these steps to add trigger code to select the first record value with the First/Last spin box:

  1. Select the First/Last spin box and open the Section Editor.
  2. Choose the New button in the Section Editor to open the Choose Event dialog box.
  3. Select OCX.SpinDown in the Common OCX Events list, and choose OK.
  4. Position the cursor below the comments section and above the END PROCEDURE statement.
  5. Choose 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 fetchFirst.
  8. Choose OK.
  9. The new trigger code appears in the Section Editor.

Coding the First/Last Spin Box To Fetch the Last Record

Follow these steps to add trigger code to select the last record value with the First/Last spin box:

  1. Choose the New button in the Section Editor to open the Choose Event dialog box.
  2. Select OCX.SpinUp in the Common OCX Events list, and choose OK.
  3. Position the cursor below the comments section and above the END PROCEDURE statement.
  4. Choose 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, and select fetchLast.
  7. Choose OK.
  8. The trigger code appears in the editor.

  9. In the Section Editor, choose File Close Window to save the new code and close the window.
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.

Follow these steps to view the partially assembled window:

  1. Choose 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 window:
  2. Hold your pointer over a button to view the ToolTip.
  3. Choose the context sensitive help button (?) in the upper-right corner of the window and then choose a button to see the context sensitive help.
  4. Choose 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 move on to building the Order Line section.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095