🖥️ VB CURSE DIFFICULTY: Apprentice Structural

The Composite of Form Controls

Treating a chaotic tree of ActiveX forms as a single entity.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Illusion // Structure
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// VB PATTERN //
' IComponent.cls
Public Sub Render()
End Sub

' LeafControl.cls
Implements IComponent
Private Sub IComponent_Render()
    ' Draw the cursed UI element
End Sub

' ControlContainer.cls
Implements IComponent
Private m_children As Collection

Private Sub Class_Initialize()
    Set m_children = New Collection
End Sub

Public Sub Add(c As IComponent)
    m_children.Add c
End Sub

Private Sub IComponent_Render()
    Dim child As IComponent
    On Error Resume Next
    For Each child In m_children
        child.Render
    Next child
End Sub

When a user interface is woven from dozens of volatile ActiveX components, the Composite pattern allows the Archmage to treat individual elements and their containers with a uniform incantation.

Runic Tags: #composite #ui #activex