Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : ActiveX Control Support : Accessing ActiveX controls at runtime : Instantiating the control
 
Instantiating the control
At runtime, your application uses AppBuilder-generated code to instantiate any ActiveX controls. This code (shown in following sections) uses the CREATE Widget statement to realize a separate control-frame widget for each ActiveX control, initializing each control-frame with the name specified at design time. It then invokes the LoadControls() method on each control-frame COM object to instantiate the corresponding ActiveX control, loading all design time definitions from the .wrx file.
The following figure describes the instantiation process for a single ActiveX control.
Figure 60. Instantiating an ActiveX control at runtime
Creating the control-frame widget does not, by itself, realize the control-frame. Control-frame realization occurs only after (1) it is parented to a frame widget and (2) its NAME attribute is set or its COM-HANDLE attribute is referenced. The NAME attribute is generally set first and causes realization by creating the control-frame COM object. Only then can your application use the LoadControls() method to (3) load the control into the control-frame COM object (the control container).
Note: The control-frame name must match the name specified at design time to allow LoadControls() to locate the specified ActiveX control in the .wrx file.