Progress
External Program
Interfaces
Accessing the Control Handle
Once the ActiveX control is instantiated, the control-frame affords access to one widget and three COM objects, including the:
Figure 9–4 shows the chain of handle references that connect a control-frame widget (with widget handle CF) to an ActiveX control (with the Name "CSSpin").
Figure 9–4: Handle References To Access ActiveX Controls
![]()
The chCF reference is a component handle to the control-frame COM object (control container) and the chCOL reference is a component handle to the control collection. Thus in the 4GL, you can instantiate and get the handle to an ActiveX control in two ways:
Once you have the component handle of the ActiveX control, you can access all of its properties and methods. (The chCSSpin reference is a component handle variable you might set from chCF:CSSpin or chCOL:Item(1).) The following examples reference a reduction of typical code generated by the AppBuilder. For a closer look at actual code generated by the AppBuilder, see the "Programming ActiveX Controls In the AppBuilder" section.
Using the Control-Name Property Of the Control Container
This example show how you might access the component handle to the CSSpin control using the Control-Name property:
The bolded code is the code you might add to appropriate sections of your application; the rest is a simplified version of code the AppBuilder might generate. Note how the AppBuilder uses the control-frame name (CtrlFrame) to generate handle variable names and to locate the control instance in the
csspinapp.wrx
file. The actual control name (CSSpin) is the OCX name specified for the control at design time (in this case, the CSSpin default).Using the Item Property Of the Control Collection
This similar example uses the control collection to return the control’s component handle:
The Handle Connections
The previous examples rely on attributes, properties, and methods supported by Progress to get a component handle from a control-frame widget handle (see Figure 9–4). Thus, to provide access to the control-frame widget and its related COM objects:
- The control-frame widget has a COM-HANDLE attribute that returns the component handle of the control-frame COM object.
NOTE: The control collection is a standard COM object that is used to access sets of like objects (objects in the same class).- The control-frame COM object has a Controls property that returns the component handle of the control collection. You can then use the Item property on the collection component handle to get the component handle of the control.
- The control-frame COM object has a special property named after the ActiveX control that returns the component handle of the control.
- The control-frame COM object provides a Widget-Handle property that returns the widget handle of the instantiating control-frame widget.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |