vbAccelerator - Contents of code file: cParent.cls

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "cParent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private m_cWorker() As cWorker
Attribute m_cWorker.VB_VarHelpID = -1
Private m_iCount As Long

Public Event Progress(ByRef cThis As Object, ByVal lAmount As Long)
Public Event Complete(ByRef cThis As Object)

Friend Sub Progress(ByRef cThis As cWorker, ByVal j As Long)
   RaiseEvent Progress(cThis, j)
End Sub
Friend Sub Complete(ByRef cThis As cWorker)
   RaiseEvent Complete(cThis)
End Sub

Public Function Add(ByVal sKey As String) As cWorker
   m_iCount = m_iCount + 1
   ReDim Preserve m_cWorker(1 To m_iCount) As cWorker
   Set m_cWorker(m_iCount) = New cWorker
   With m_cWorker(m_iCount)
      .Init Me
      .Key = sKey
   End With
   Set Add = m_cWorker(m_iCount)
End Function
Public Property Get Worker(ByRef sKey As String) As cWorker
Dim i As Long
   For i = 1 To m_iCount
      If m_cWorker(i).Key = sKey Then
         Set Worker = m_cWorker(i)
         Exit Property
      End If
   Next i
   Err.Raise 9, App.EXEName & ".cParent", "Subscript out of range"
End Property
Public Sub ClearUp()
Dim i As Long
   For i = 1 To m_iCount
      Set m_cWorker(i) = Nothing
   Next i
   Erase m_cWorker
   m_iCount = 0
End Sub


Private Sub Class_Initialize()
   MsgBox "cParent:Initialize"
End Sub

Private Sub Class_Terminate()
   MsgBox "cParent:Terminate"
End Sub