This project is read-only.
Intuitive instancing is the idea of encapsulating the concepts of how a composite control functions in the calling conventions of the specific classes for a control.

For example, two comboboxes exist on a form where the item selected in one combobox determines the item list of the other. Or perhaps a list of records displayed in a subform is to be filtered by a series of comboboxes, checkboxes, textboxes, etc.

Conceptually, the composite control which performs these functions is effectively "binding" controls. This is the same idea as a "bound control" in Access where a control is bound to a data source (typically a field of a recordset), such that any change in the data source is immediately reflected in the control itself. In the same way, the example is seeking to bind controls together such that changes in one immediately affects another.

The Binder Control

Using our above example with the idea that we want to bind controls to other controls or forms (or forms to controls), we may call such a composite control a "binder". A binder must then manage the required updating between specified controls and forms as changes in a control are made. It would be helpful to name these connections and it would seem intuitive to say that a binder binds a form or control to other forms / controls using "bindings".

For a VBA pseudo-code example, where a subform is filtered with the data from other controls:

'Declare the new binder composite control
Dim binderObject as ccBinder
Set binderObject = new ccBinder

'initialize the binder control with a reference to the control which it will update
binderObject.Initialize ([Parent Form].[Subform].Form)

'bind a specific field of the subform to a combobox's current value for automatic filtering when the specified combobox events fire
binderObject.Addbinding ([Parent Form].FilteringCombobox, [Subform Field], "FilteringEvent1", "FilteringEvent2", "FilteringEvent3")

This sort of intuitive instancing reflects what's occurring at a conceptual level: the subform is identified as the target to which other controls are to be bound (it's assigned a "binder"), then the target control is bound to other controls using "bindings" which are updated by the specified events and managed internally by the binder itself.

The ccBinder class then manages this entire process, leaving the end user free to specify what could easily become a complex array of event calls using concise and obvious code.

Last edited Dec 7, 2010 at 9:47 AM by vba_junkie, version 2


No comments yet.