skip to main content
OpenEdge Development: AppBuilder
Other Objects : ActiveX (OCX) objects
 
ActiveX (OCX) objects
ActiveX (OCX) controls are objects that are conceptually similar to ABL widgets and ADM SmartObjects, but written to Microsoft’s Component Object Model (COM) standard. ActiveX objects supply encapsulated functionality of various kinds, and are available from a number of third-party vendors. The COM standard is the current successor to the older VBX standard.
Note: AppBuilder supplies only three ActiveX objects that you can use freely in your applications. In general, using an ActiveX object requires a separate licence from the supplier of the object.
AppBuilder allows you to select and position ActiveX objects in your GUI workspace in the same way you select and position native ABL and SmartObjects. To make this work, AppBuilder supplies a two‑layer interface between the ActiveX object itself and the AVM. The two layers are a control frame widget and a Control-Frame COM object. They translate between the Microsoft and AVM standards.
Although the control frame interface is too general a mechanism to make the differences between ActiveX objects and ABL fully transparent to you, this section provides a general overview of how to create and configure instances.
For a full technical discussion of ActiveX objects in OpenEdge applications, see OpenEdge Development: Programming Interfaces manual.
Creating an ActiveX object instance
Although an ActiveX object is very different, internally, to an ABL object or SmartObject, the basic process of selecting and placing an OCX object is similar to the process for a native ABL object.
To select and place an OCX object:
1. Click OCX in the Objects Palette.
2. The dialog box that appears lists all ActiveX controls found within your development system, as shown:
AppBuilder does not know whether the controls it finds are licensed. Before using an OCX object, verify you have a license.
3. Select the object you wish to use, and click OK. Move your mouse cursor over a bare spot in your workspace and click to place the instance.
4. Configure and size the object.
Generic ActiveX event handlers
You might sometimes find that you have several ActiveX objects, perhaps of different kinds, that can all register the same kind of event. If it would meet your needs, you can write a single event handler that will respond to that event regardless of which object instance experiences it. If you do write such a generic handler, it need not apply to all objects. You can override it by writing handlers that you bind to specific instances. You can have only one generic handler for a particular event type, but you can have as many instance‑specific handlers as you like.
Inside the event handler, use the generic identifier COM-SELF to refer to the object instance that experienced the event. For example, to refer to the experiencing instance’s Value property in a generic handler, you would use the expression COM-SELF:Value. Note that you do not need to use the usual chInstanceHandle:OCXName:Value format.
To create a generic event handler:
1. Choose WindowCode Section Editor to open that window. Set the Section to Procedures, not Triggers, and click New.
2. Type in ANYWHERE.Eventname as the name of the procedure (where Eventname is the actual name of the event, as for example Tick, Click, Choose, etc.).
3. Insert the code for handling the event.
4. If you want to bind a special handler to a particular instance, overriding the generic handler, set Section to Triggers, and click New. Select the same event and define the special handler for it.
5. If you want to remove a special handler, making the generic handler the new event‑service routine, bring the special handler up in the edit window and choose EditDelete Trigger.
ActiveX (OCX) properties data
AppBuilder saves in a single file the properties data for all OCX objects that are local to a particular external procedure. (The file is not human readable.) By default, AppBuilder saves that file in the same directory where it saves the source files for the procedure, and using the same basic name with the extension .wrx. You can choose to use a different directory and/or filename.
To use a different directory and/or filename:
1. Choose ToolsProcedure Settings.
2. From the OCX Binary drop‑down list, select Other.
3. Type in the new filename, including the path if you want AppBuilder to store the file in some place other than in the default working directory.