Generating an Active Form Based on a VCL Form
Go Up to Using ActiveX Controls Index
Unlike other ActiveX controls, Active Forms are not first designed and then wrapped by an ActiveX wrapper class. Instead, the Active Form wizard generates a blank form that you design later when the wizard leaves you in the Form Designer.
You can test an Active Form by creating an HTML page to contain a reference to the Active Form and specify its location on the page. The Active Form can then be displayed and run from a Web browser. Inside the browser, the form behaves just like a stand-alone Delphi form. The form can contain any VCL components or ActiveX controls, including custom-built VCL controls.
To start the Active Form wizard:
- Choose either:
- File > New > Other > Delphi Projects > ActiveX > ActiveX Library
- File > New > Other > C++Builder Projects > ActiveX > ActiveX Library
- This creates a Dynamic Link Library [DLL] project that you can use to host in-process ActiveX Objects.
- Now choose either:
On the Active Form wizard, you cannot specify the name of the VCL class to wrap. This is because Active forms are always based on Vcl.AxCtrls.TActiveForm.
You can change the default names for the CoClass, implementation unit, and ActiveX library project. Similarly, this wizard lets you indicate whether you want your Active Form to require a license, whether it should include version information, and whether you want an About box form.
When you exit the wizard, it generates the following:
- An ActiveX Library project file, which contains the code required to start an ActiveX control. You usually don't change this file.
- A type library, which defines a CoClass for your control, the interface it exposes to clients, and any type definitions that these require. For more information about the type library, see Working with Type Libraries - Overview.
- A form that descends from AxCtrls.TActiveForm. This form appears in the Form Designer, where you can use it to visually design the Active Form that appears to clients. Its implementation appears in the generated implementation unit. In the initialization section of the implementation unit, a class factory is created, setting up Vcl.AxCtrls.TActiveFormControl as the ActiveX wrapper for this form.
- An About box form and unit if you requested them.
- An .LIC file if you enabled licensing.
At this point, you can add controls and design the form as you like.
After you have designed and compiled the Active Form project into an ActiveX library (which has the OCX extension), you can create a test HTML page that contains a reference to the Active Form. Then you can test the project using an ActiveX-enabled Web browser. For instructions, see Creating a VCL Forms ActiveX Active Form.