Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : ActiveX Control Support : Handling events : Managing external procedure files
 
Managing external procedure files
As described earlier (see Handling ActiveX control events), you can define OCX event procedures in external procedure files other than the one where you instantiate the ActiveX control. If you do create these external procedure files, you need to tell ABL how to locate the event procedures when responding to ActiveX control events. You do this by creating a search list of your external procedures.
The control-frame widget provides two methods for you to manage this search list:
*ADD-EVENTS-PROCEDURE( procedure-handle )
*REMOVE-EVENTS-PROCEDURE( procedure-handle )
These methods require that your external procedures are running persistently or on the procedure call stack. To have ABL locate an event procedure in one of these external procedures, you invoke the ADD-EVENTS-PROCEDURE( ) on the control-frame widget, passing the procedure handle of the external procedure. To remove an external procedure from the search list, you pass its procedure handle to the REMOVE-EVENTS-PROCEDURE( ) method on the control-frame widget.
When ABL responds to a control event, it searches the assembled list of external procedures to find a matching control-bound event handler, searching in order of the most recently added procedure first. Finally, it searches the application file where the control is instantiated. If it cannot find a control-bound event handler, it searches the list again for a matching generic event handler, always searching the main application file last. In this way, ABL selects the first matching event handler to handle the incoming event.
Using these methods, you can dynamically add and remove procedures from the search list, overriding or replacing previously added procedures. Thus, modifying this search list can have a powerful effect on the behavior of an application.