cControl_EventHandler Object Members

The cControl_EventHandler class acts as an event sink for an object which is an event source. The object for which the EventHandler class acts as a sink may be an ActiveX object, a cControl object, or any object which is capable of raising trappable events.

One cControl_EventHandler class must be created for each object type which has events to be trapped. While this has the potential to create a larger number of class modules to manage several different types of controls, each class is largely identical to another, with exception of the type of reference to the control which acts as the event source, and the individual events made available.

All cControl_EventHandler classes have an OnStartup and OnTerminate event. These events are tied to other events, typically the OnOpen and OnClose events of the control's parent form. For example, if a cControl_EventHandler class is created to manage comboboxes (i.e., cControl_EventHandler_Combobox), it's OnStartup and OnTerminate events would typically be tied to the combobox control's parent form's OnOpen / OnClose events. In truth, these events may be tied to any event of a parent object as the developer wishes, but it makes logical sense that a control's OnStartUp / OnTerminate events occur when the parent form is opened / closed.

The cControl_EventHandler class uses an interface, iControl_EventHandler to provide continuity across the many EventHandler classes that may be required in a project. The iControl_EventHandler interface guarantees certain basic properties and methods are available, regardless of the control which a particular EventHandler class managers, and allows for stronger data typing throughout the project.

Code Modules

Name Standard / Class Description
Support_Globals Standard Support module providing global variables and enumerations.
Support_General Standard Support module providing general functions used by multiple Composite Control classes.
Support_EventHandler.bas Standard Support module for the cControl_EventHandler class and the cControlChild_Event class.
cControl_EventHandler_[Control Type].cls Class Class module for the cControl_EventHandler class.


Name Description
AttachToEventHandler Attach the object's OnStartup / OnTerminate events to another cControl_EventHandler object.
Initialize Initializes the cControl_EventHandler object.
regRef Registers a Composite Controls object with the global object references collection in the CompositeControls class instance.
StartUp_ Callback method for the OnStartUp event. Used internally.
Terminate_ Callback method for the OnTerminate event. Used internally.
Terminate Terminates the cControl_EventHandler object.
Trigger Triggers an event local to the cControl_EventHandler object.


Name Description
Control Returns a reference to the control which serves as an event source.
ControlCallbacks Returns a reference to the collection of callback functions that are run whenever any event of the control is triggered.
ControlType Returns the type of control.
Events Returns a collection of the {'cControlChild_Event"} instances created for the specific cControl_EventHandler class.
GlobalCallbacks Returns a collection of callbacks that are triggered for multiple cControl_EventHandler object events.
IsInitialized Returns whether or not the object has been initialized.
Name Returns the name of the object.
Parent Returns the parent object.
OnEvent Returns a reference to the cControlChild_Event class assigned to the particular event name.
Tag Stores unique identifier for object.

Last edited Dec 22, 2010 at 11:10 PM by vba_junkie, version 12


No comments yet.