This project is read-only.

cControlChild_Event.AddFn Method

Add callback functions to the class registry for delegation when the event fires.


expression.AddFn(fnName, fnObject, fnType, key, AddLast)

expression A variable that represents a cControlChild_Event object.


Name Requiredd / Optional Data Type Description
fnName Required String Name of the callback function to add to the registry
fnObject Optional Object Reference to the object of which the function is a member. Not required if function is in a standard module. Default is Nothing.
fnType Optional VbCallType Type of callback function (VbGet, VbSet, VbLet, VbMethod). Default is VbMethod Ignored if fbObject is not passed.
key Optional Variant Key under which to store the callback function in the registry. If specified, overrides the default (uses the function name). Default is zero-length-string.
AddLast Optional Boolean If true, indicates function is to be added to the end of the registry. Default is false.


All functions added to the callback registry must implement the standard callback signature for a Composite Control. See callback functions for more details.

All functions must be Public members of the standard module / class module in which they reside.

fnType must be specified if the function is a member of a class.

Functions are called in reverse order of their addition to the registry. That is, each function is added to the start of the registry, unless AddLast is True. This enables termination callbacks to be ordered such that the termination method for the local object is not called before the callback registry for it's termination event.


This example adds a function to the cControlChild_Event object that is the "OnClick" member of a cControl_EventHandler_ComboBox class. The callback function is located in a standard module.

'Access directly via the cControlChild_Event member
comboEventHandler.OnClick.AddFn "MyStandardCallbackFn"

'Access via the event handler class's Events collection.
comboEventhandler.Events("OnClick").AddFn "MyStandardCallbackFn"

This example adds a callback function that is a member of a class.

comboEventHandler.OnClick.AddFn "MyClassCallbackFn", MyCallbackObject

Last edited Dec 19, 2010 at 3:33 AM by vba_junkie, version 1


No comments yet.