Skip to content

Adding ActiveX Controls to the Order Entry System

In this section, you will learn how to import ActiveX controls and add them to existing applications. You will add an ActiveX data-aware calendar control to the Order Entry view.

Important!

This section assumes that you have been going through the Creating a Complete Order Entry System tutorial step by step.

If you skipped the Creating Windows Data Entry Components part of the tutorial, and more specifically, Creating the Order Entry View, you should complete that section now and return here when you have completed it.

Steps to Add ActiveX Controls

  1. Open the DataFlex Studio to the OrderTutorial workspace.

  2. Click on the Create New button on the Studio’s toolbar. Click on the Class tab. Double-click the Import COM ActiveX icon.

  3. After the list of available ActiveX controls on your PC populates, select Microsoft Calendar Control 11.0 (version 7.0). The version of the control may vary slightly with your operating system or version of Office installed.

  4. Check the checkbox in the Data-Aware column. Accept the defaults for the remaining settings in this dialog and click Ok.

  5. You should see a message box that informs you that the control has imported successfully. After clicking Ok on the message box dialog, the newly created DataFlex package for the control should load in the Studio.

  6. Open the Order Entry view in the visual designer.

  7. Extend the width of the view control to the right.

  8. Drop a ComDbCalendar control onto the view from the ActiveX group of the Class Palette. Resize it to look more or less like this:

  9. Right-click on the calendar control and select ActiveX Properties from the context menu.

  10. This opens the "ActiveX Control Properties" dialog, which allows you to view and change properties specific to any ActiveX control. This dialog will display different properties for every ActiveX control imported into the Studio.

  11. Uncheck the Month/Year Title checkbox and click Ok.

  12. Change the peAnchors property of the oComDbCalendar1 control to anTopBottomRight.

  13. Still in the Properties window, click on the Data Binding tab.

  14. Since this is a database-aware control, we want to connect the control to a database table and column. Click on the prompt (...) button for the Data Source (Entry_Item).

  15. In the DDO Column Selection dialog, select the Order_Date column from the OrderHeat table and click Ok.

  16. You can now test compile and run the Order Entry view and see the new calendar control in action. Click on the Run button on the Studio's toolbar to compile and run project Order.src.

When the application runs, click on the View menu and then Order Entry View to open the view. Find any existing Order and see that the calendar control displays the correct date for the current order.

You see how easy it is to add ActiveX controls and even data-aware ActiveX controls to your DataFlex applications.