Public Sub SetStyles(lb As ListBox, ByVal nMode As Byte)
Select Case nMode
Case 0
SetWindowLong lb.hwnd, GWL_STYLE, WS_CHILD Or _
WS_VISIBLE Or WS_CLIPSIBLINGS Or WS_TABSTOP Or _
LBS_EXTENDEDSEL
SetWindowLong lb.hwnd, GWL_EXSTYLE, WS_EX_NOPARENTNOTIFY
Case 1
SetWindowLong lb.hwnd, GWL_STYLE, WS_CHILD Or _
WS_VISIBLE Or WS_CLIPSIBLINGS Or WS_TABSTOP Or _
WS_VSCROLL
SetWindowLong lb.hwnd, GWL_EXSTYLE, WS_EX_NOPARENTNOTIFY
End Select
End Sub
Public Sub Remove(Index As Variant)
tmpFieldCol.Remove Index
End Sub
Public Sub Item(Index As Variant)
Set Item = tmpFieldCol.Item(Index)
End Sub
Public Sub SetCursor(ByVal nLbIndex As Long)
Dim lb As ListBox
For Each lb In tmpFieldCol
lb.ListIndex = nLbIndex
Next
End Sub
Public Sub DeleteRow(ByVal nLbIndex As Long)
Dim lb As ListBox
For Each lb In tmpFieldCol
lb.RemoveItem nLbIndex
Next
End Sub
Public Sub GetInputBox(ByVal nLbIndex As Long, ByVal Index As Long, tb As _
TextBox)
Dim r As RECT
SendMessage tmpFieldCol.Item(Index).hwnd, LB_GETITEMRECT, nLbIndex, r
With tb
.Text = ""
.Left = tmpFieldCol.Item(Index).Left + r.Left * Screen.TwipsPerPixelX
.Top = tmpFieldCol.Item(Index).Top + r.Top * Screen.TwipsPerPixelY
.Width = r.Right * Screen.TwipsPerPixelX
.Height = r.Bottom * Screen.TwipsPerPixelY - r.Top * Screen.TwipsPerPixelY
.Visible = True
.SetFocus
End With
End Sub
Public Property Get AktFeld() As Long
AktFeld = tmpField
End Property
Public Property Let AktFeld(ByVal nIndex As Long)
tmpField = nIndex
End Property
Public Property Get AktIndex() As Long
AktIndex = tmpIndex
End Property
Public Property Let AktIndex(ByVal nIndex As Long)
tmpIndex = nIndex
End Property
Public Sub ChangeFieldText(ByVal sText As Variant)
tmpFieldCol(tmpField).List(tmpIndex) = sText
If tmpField <> tmpFieldCol.Count Then
ShowScrollBar tmpFieldCol(tmpField).hwnd, SB_VERT, False
End If
End Sub
Public Sub LBScroll(ByVal Index As Long)
Dim nTopItem As Long
Dim lb As ListBox
nTopItem = SendMessage(tmpFieldCol(Index).hwnd, LB_GETTOPINDEX, 0, ByVal 0)
For Each lb In tmpFieldCol
If lb.Index <> tmpFieldCol.Count Then
SendMessage lb.hwnd, LB_SETTOPINDEX, nTopItem, ByVal 0
ShowScrollBar lb.hwnd, SB_VERT, False
End If
Next
End Sub
Public Sub ChangeColumnWidth(ByVal Index As Long, ByVal nWidth As Long)
Dim lb As ListBox
Dim nLeftPos As Long
Dim i As Boolean
tmpFieldCol(Index).Width = nWidth
i = True
For Each lb In tmpFieldCol
If Not i Then
lb.Left = nLeftPos
nLeftPos = nLeftPos + lb.Width
Else
nLeftPos = lb.Left + lb.Width
End If
i = False
Next
End Sub Noch ein bisschen dran feilen - dann geht's 0 |