The Mediator of the Form Global
Centralizing event hell between a dozen interlocking ActiveX controls.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Mediator
ARCANUM SCHOOL: Enchantment // Orchestration
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// VB PATTERN //
' FrmMainMediator.frm
' This form acts as the mediator
Private Sub cmdAction_Click()
' Coordinate the other controls
txtStatus.Text = "Ritual Begun"
picAltar.BackColor = vbRed
End Sub
Public Sub Notify(sender As String, evt As String)
If sender = "DemonControl" And evt = "Awoken" Then
txtStatus.Text = "Containment Breach"
End If
End Sub
When ActiveX controls communicate directly with one another, a tangled web of events emerges. The Mediator (usually a central Form) swallows these events, acting as the sole orchestrator of the chaos.
Runic Tags:
#mediator
#forms
#activex