Name |
Description |
An ActiveX control involves many elements which each perform a specific function. The elements include a VCL control, a corresponding COM object wrapper that exposes properties, methods, and events, and one or more associated type libraries. | |
When designing an ActiveX control, you start by creating a custom VCL control. This forms the basis of your ActiveX control. For information on creating custom controls, see Creating custom components. When designing the VCL control, keep in mind that it will be embedded in another application; this control is not an application in itself. For this reason, you probably do not want to use elaborate dialog boxes or other major user-interface components. Your goal is typically to make a simple control that works inside of, and follows the rules of the main application. In addition, you should make... more | |
Unlike other ActiveX controls, Active Forms are not first designed and then wrapped by an ActiveX wrapper class. Instead, the ActiveForm wizard generates a blank form that you design later when the wizard leaves you in the Form Designer. When an ActiveForm is deployed on the Web, Delphi creates an HTML page to contain the reference to the ActiveForm and specify its location on the page. The ActiveForm can then 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,... more | |
Licensing an ActiveX control consists of providing a license key at design-time and supporting the creation of licenses dynamically for controls created at runtime. To provide design-time licenses, a key is created for the control , which is stored in a file with the same name as the project with the LIC extension. This .LIC file is added to the project. The user of the control must have a copy of the .LIC file to open the control in a development environment. Each control in the project that has Make Control Licensed checked has a separate key entry in... more | |
You can add, edit, and remove the properties, methods, and events in an ActiveX control by editing the type library. You can use the Type Library editor as described in Using the Type Library Editor. Remember that when you add events, they should be added to the Events interface, not the ActiveX control's default interface. Note: You can add unpublished properties to your ActiveX control's interface. Such properties can be set at runtime and will appear in a development environment, but changes made to them will not persist. That is, when the user of the control changes the value... more | |
You can add additional properties, methods, and events to the control using the type library editor. The declaration is automatically added to the control's implementation unit, type library (TLB) file, and type library unit. The specifics of what Delphi supplies depends on whether you have added a property or method or whether you have added an event. | |
The ActiveX wrapper class implements properties in its interface using read and write access methods. That is, the wrapper class has COM properties, which appear on an interface as getter and/or setter methods. Unlike VCL properties, you do not see a "property" declaration on the interface for COM properties. Rather, you see methods that are flagged as property access methods. When you add a property to the ActiveX control's default interface, the wrapper class definition (which appears in the _TLB unit that is updated by the Type Library editor) gains one or two new methods (a getter and/or setter) that... more | |
The ActiveX control can fire events to its container in the same way that an automation object fires events to clients. This mechanism is described in Managing events in your Automation object. If the VCL control you are using as the basis of your ActiveX control has any published events, the wizards automatically add the necessary support for managing a list of client event sinks to your ActiveX wrapper class and define the outgoing dispinterface that clients must implement to respond to events. You add events to this outgoing dispinterface. To add an event in the type library editor,... more | |
With simple data binding, you can bind a property of your ActiveX control to a field in a database. To do this, the ActiveX control must communicate with its host application about what value represents field data and when it changes. You enable this communication by setting the property's binding flags using the Type Library editor. By marking a property bindable, when a user modifies the property (such as a field in a database), the control notifies its container (the client host application) that the value has changed and requests that the database record be updated. The container interacts with... more | |
A property page is a dialog box similar to the Delphi Object Inspector in which users can change the properties of an ActiveX control. A property page dialog allows you to group many properties for a control together to be edited at once. Or, you can provide a dialog box for more complex properties. Typically, users access the property page by right-clicking the ActiveX control and choosing Properties. | |
You use the Property Page wizard to create a new property page. | |
You must add a control to the property page for each property of the ActiveX control that you want the user to access. For example, the following illustration shows a property page for setting the MaskEdit property of an ActiveX control. The list box allows the user to select from a list of sample masks. The edit controls allow the user to test the mask before applying it to the ActiveX control. You add controls to the property page the same as you would to a form. | |
After adding the controls you need to the property page, you must associate each control with its corresponding property. You make this association by adding code to the property page's UpdatePropertyPage and UpdateObject methods. | |
Add code to the UpdatePropertyPage method to update the control on the property page when the properties of the ActiveX control change. You must add code to the UpdatePropertyPage method to update the property page with the current values of the ActiveX control's properties. You can access the ActiveX control using the property page's OleObject property, which is an OleVariant that contains the ActiveX control's interface. For example, the following code updates the property page's edit control (InputMask) with the current value of the ActiveX control's EditMask property: | |
Add code to the UpdateObject method to update the property when the user changes the controls on the property page. You must add code to the UpdateObject method in order to set the properties of the ActiveX control to their new values. You use the OleObject property to access the ActiveX control. For example, the following code sets the EditMask property of the ActiveX control using the value in the property page's edit box control (InputMask): | |
Describes the steps in connecting an ActiveX control to a property page. To connect a property page to an ActiveX control:
|
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|