Image of Navigational Map linked to Home / Contents / Search 95 Style Status Bar for Windows 3.11

Listing 2 looks like this...
Image of Line Break

Option Explicit
Private mPanels As Collection
Private mpicParent As Object

Public Function Add(Optional Index, Optional Key, Optional Text, 
  Optional Style, Optional Picture)
Dim pnlX As New Panel
Dim idx As Long
Dim nCurrentPanel As Long
nCurrentPanel = Count
If Not IsMissing(Text) Then pnlX.Text = Text
If Not IsMissing(Style) Then pnlX.Style = Style
If Not IsMissing(Key) Then pnlX.Key = Key
If Not IsMissing(Index) Then
If Index + 1 > nCurrentPanel Then
idx = nCurrentPanel + 1
ElseIf Index < 1 Then
idx = 1
Else
idx = Index
End If
Else
idx = nCurrentPanel + 1
End If

If nCurrentPanel = 0 Then
mPanels.Add pnlX, Key
Else
If idx > nCurrentPanel Then
mPanels.Add pnlX, Key
Else
mPanels.Add pnlX, Key, idx
End If
End If

Set pnlX.Parent = mpicParent
If Not IsMissing(Picture) Then Set pnlX.Picture = Picture
pnlX.Visible = True
Set Add = pnlX
Set pnlX = Nothing

End Function
 

Private Sub Class_Initialize()
Set mPanels = New Collection
Load frmStatusRes

End Sub


Private Sub Class_Terminate()
Unload frmStatusRes
Clear
Set mPanels = Nothing
Set mpicParent = Nothing

End Sub

 
Public Sub Clear()
Do Until Count = 0
mPanels.Remove 1
Loop

End Sub
 

Public Function Count() As Long
Count = mPanels.Count

End Function


Public Function Item(Value) As Panel
On Error Resume Next
Set Item = mPanels.Item(Value)
If Err.Number <> 0 Then
Err.Clear
Set Item = Nothing
End If

On Error GoTo 0

End Function

 
Public Property Set Parent(Value As Object)
Set mpicParent = Value

End Property


Public Property Get Parent() As Object
Set Parent = mpicParent

End Property

 
Public Sub Remove(Value)
mPanels.Remove Value

End Sub


Image of Arrow linked to Previous Article
Image of Line Break
[HOME] [TABLE OF CONTENTS] [SEARCH]