I think this addition also needs to be made
I'm also experimenting with adding a 'NewIndex" property as that can be useful in some cases. For that I have added to the above codeCode:Public Sub Init() 'resets the entire module ... tComboInit.iOverlay = 0 tComboInit.lpData = 0
and this in declarationCode:tComboInit.iOverlay = 0 tComboInit.lpData = 0 nComboNewIndex = 0
propertyCode:Private nComboIdx As Long Private nComboNewIndex As Long
and finally I made these changes to ComboAddItem and at the same time cut down on the use of UBound() to make the code a tad more efficientCode:Public Property Get ComboHeight() As Long: ComboHeight = cyCombo: End Property Public Property Get ComboNewIndex() As Long: ComboNewIndex = nComboNewIndex: End Property Public Property Let SliderAlign(nAlign As TDInputBoxAlign): nSliderAlign = nAlign: End Property
Maybe you prefer the repeated calls to UBound as your coding style, I just try to avoid unnecessary calls :-)Code:Public Sub ComboAddItem(sText As String, Optional iImage As Long = -1, Optional iOverlay As Long = -1, Optional lParam As Long = 0) If aComboItems(0).sText = "" Then aComboItems(0).sText = sText aComboItems(0).iImage = iImage aComboItems(0).iOverlay = iOverlay aComboItems(0).lpData = lParam Exit Sub End If nComboNewIndex = UBound(aComboItems) + 1 ReDim Preserve aComboItems(nComboNewIndex) aComboItems(nComboNewIndex).sText = sText aComboItems(nComboNewIndex).iImage = iImage aComboItems(nComboNewIndex).iOverlay = iOverlay aComboItems(nComboNewIndex).lpData = lParam If hCombo Then CBX_InsertItem hCombo, sText, iImage, iOverlay, lParam End If End Sub




Reply With Quote