Instantiating the control
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Instantiating the control
The AppBuilder generates the code to instantiate the ActiveX control starting with a call to the enable_UI procedure from the Main Block. For example:
|
The programmer has added the comments and code that immediately follow the call to enable_UI. Here, they must set max-records to the number of records in the query only after the query is opened (again, in enable_UI), but before the spin button control is available to scan the result. The reason for this becomes clearer in later code fragments.
The following reduction of the enable_UI procedure shows
that the AppBuilder generates the code to load the ActiveX control (RUN
control_load) before its static parent frame and family
of ABL widgets are displayed and enabled:
|
The initial value of iRecordCount is also set
at control load time (see Initializing the control). Note also that the application query is opened to
obtain the data for the frame:
The control_load procedure, called from enable_UI,
is an AppBuilder-generated procedure that loads the ActiveX control
into the control-frame by executing the LoadControls( ) method
of the control-frame COM object. Note the call to initialize-controls,
an optional internal procedure that you can define (and which is
defined in this example) to modify control properties before the
control becomes visible. For example:
|
You can view but you cannot change this AppBuilder-generated code from the Section Editor.
You might wonder why you cannot
load the control with a chained handle reference CtrlFrame:COM-HANDLE:LoadControls(
... ). The reason is that even though CtrlFrame:COM-HANDLE returns
a component handle, it does so with reference to a widget attribute (COM-HANDLE),
not a COM object property or method. You cannot make a component
handle expression by chaining widget handle references (that return
component handles) with component handle references.