Search Tools Links Login

Tabs in Listbox

Visual Basic 6, or VB Classic

Set tab stops in listbox

Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function GetDialogBaseUnits Lib "USER32" () As Long

Sub SetTabStops(lListWindowHandle As ListBox, iNoTabStops As Integer, lTabPositions() As Long)
   Dim iIndex As Integer
   Dim lDialogBaseUnits As Long
   Dim iDialogUnitsX As Integer
   lDialogBaseUnits = GetDialogBaseUnits()
   iDialogUnitsX = (lDialogBaseUnits And &HFFFF&) \ 4
   ReDim lTabPos(0 To iNoTabStops - 1) As Long
   For iIndex = 0 To iNoTabStops - 1
      lTabPos(iIndex) = lTabPositions(iIndex) * iDialogUnitsX * 2
   Next iIndex
   Call SendMessage(lListWindowHandle.hWnd, LB_SETTABSTOPS, CLng(iNoTabStops), lTabPos(0))
End Sub

About this post

Posted: 2020-08-30
By: vb6boy
Viewed: 269 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.