vbAccelerator - Contents of code file: cSubItems.clsVERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "cSubItems"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private m_iCount As Long
Private m_sText() As String
Private m_lImage() As Long
Public Property Get Count() As Long
Count = m_iCount
End Property
Public Property Get Item(ByVal lIndex As Long) As String
If (lIndex > 0) And (lIndex <= m_iCount) Then
Item = m_sText(lIndex)
End If
End Property
Public Property Let Item(ByVal lIndex As Long, ByVal sText As String)
If (lIndex > 0) Then
If (lIndex <= m_iCount) Then
m_sText(lIndex) = sText
ElseIf (lIndex < 48) Then ' sanity
m_iCount = lIndex
ReDim Preserve m_sText(1 To m_iCount) As String
ReDim Preserve m_lImage(1 To m_iCount) As Long
m_sText(lIndex) = sText
End If
End If
End Property
Public Property Get Image(ByVal lIndex As Long) As Long
If (lIndex > 0) And (lIndex <= m_iCount) Then
Image = m_lImage(lIndex)
End If
End Property
Public Property Let Image(ByVal lIndex As Long, ByVal lImage As Long)
If (lIndex > 0) Then
If (lIndex <= m_iCount) Then
m_lImage(lIndex) = lImage
ElseIf (lIndex < 48) Then ' sanity
m_iCount = lIndex
ReDim Preserve m_sText(1 To m_iCount) As String
ReDim Preserve m_lImage(1 To m_iCount) As Long
m_lImage(lIndex) = lImage
End If
End If
End Property
Public Sub Remove(ByVal lIndex As Long)
Dim i As Long
If (lIndex > 0) And (lIndex <= m_iCount) Then
If m_iCount = 1 Then
m_iCount = 0
Erase m_sText
Erase m_lImage
Else
For i = lIndex + 1 To m_iCount - 1
m_sText(i - 1) = m_sText(i)
m_lImage(i - 1) = m_lImage(i)
Next i
m_iCount = m_iCount - 1
ReDim Preserve m_sText(1 To m_iCount) As String
ReDim Preserve m_lImage(1 To m_iCount) As Long
End If
End If
End Sub
|
|