C++Builder 5 Developers Guide
Another topic that we could spend a whole chapter discussing is ActiveX controls. Briefly, ActiveX controls are inproc COM servers representing a software component that can be integrated into an existing application to add functionality. In many ways, they are very similar to a VCL control, except it's COM-based and can be used by a number of applications that support ActiveX controls including C++Builder, Delphi, Visual Basic, and Internet Explorer.
Within C++Builder, you can add ActiveX controls to your component palette in the IDE just like a VCL control. The object inspector can be used to modify the properties of an ActiveX control dropped on a form. Property editors can sometimes be provided within an ActiveX control, which enables further property manipulation. To activate a property editor, simply right-click the ActiveX control that has been dropped on your form.
C++Builder provides the ActiveX Control Wizard for creating ActiveX controls based on a VCL. This is illustrated in Figure 17.21.
Figure 17.21. The ActiveX Control Wizard.
This wizard enables you to create an ActiveX control that wraps a VCL class. To activate this wizard, start with a clean project by selecting File, New, Other, and select the ActiveX tab within the New Items dialog as illustrated in Figure 17.3. Then, select the ActiveX Control glyph.
Here are the steps associated to creating an ActiveX control within C++Builder.
-
Choose or create a new VCL control that forms the basis of your ActiveX control.
-
Activate the ActiveX control wizard and identify the VCL you've selected or created in Step 1.
-
To create one or more property pages for the ActiveX control, use Borland's ActiveX property page wizard found on the New Items dialog under the ActiveX view.
-
If you created a property page, associate it with the ActiveX control.
-
Build and Register your ActiveX control.
-
Test your ActiveX control by embedding it within potential target applications.
-
If your ActiveX control is Web-capable (through Internet Explorer), deploy it on the Web.
You'll notice when creating ActiveX controls that you start with creating the class to an object before you create the COM interface to our control. This is somewhat in reverse from what we did earlier. After the control is written, the type library can be generated.
Another form of ActiveX control that we can create is an Active Form, which is intended for deployment on the Web. To begin to create an Active Form, start with a clean project by selecting File, New, Other, and select the ActiveX tab within the New Items dialog as illustrated in Figure 17.3. Then, select the Active Form glyph. This will enable you to use the IDE's form designer to create a visual control, such as a dialog, that can be deployed and accessed using the Web.
The Borland Help provides additional information on creating ActiveX controls and Active Forms. You're encouraged to look at this material for further details.
|
|
Top |