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
-
Open the DataFlex Studio to the
OrderTutorialworkspace. -
Click on the
Create Newbutton on the Studio’s toolbar. Click on theClasstab. Double-click theImport COM ActiveXicon. -
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.

-
Check the checkbox in the
Data-Awarecolumn. Accept the defaults for the remaining settings in this dialog and clickOk. -
You should see a message box that informs you that the control has imported successfully. After clicking
Okon the message box dialog, the newly created DataFlex package for the control should load in the Studio. -
Open the
Order Entryview in the visual designer. -
Extend the width of the view control to the right.
-
Drop a
ComDbCalendarcontrol onto the view from theActiveXgroup of the Class Palette. Resize it to look more or less like this:

-
Right-click on the calendar control and select
ActiveX Propertiesfrom the context menu. -
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.

-
Uncheck the
Month/Year Titlecheckbox and clickOk. -
Change the
peAnchorsproperty of theoComDbCalendar1control toanTopBottomRight. -
Still in the Properties window, click on the
Data Bindingtab.

-
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 theData Source (Entry_Item). -
In the
DDO Column Selectiondialog, select theOrder_Datecolumn from theOrderHeattable and clickOk.

-
You can now test compile and run the Order Entry view and see the new calendar control in action. Click on the
Runbutton on the Studio's toolbar to compile and run projectOrder.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.