-
Hiyas,
I've got 5 ListBoxes, setup as an array. I also have two buttons, a scroll up and a scroll down button. How do I make it so when I click on the buttons it scrolls every single box? I'd prefer it so when you hold the button down it keeps scrolling (like a normal scrollbar).
Thanks!
-Git
-
Or even better, how do you make adjustable listboxes? Like those in Netscape Messenger or Outlook, the lists how you can adjust the Name, Sender, Date fields, etc. horiztontally...?
-Git
-
This should solve your first question
for your second one you need to use a listview
Code:
Option Explicit
Const UP = 1
Const DOWN = 2
Dim direction As Integer
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = True
direction = UP
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
End Sub
Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = True
direction = DOWN
End Sub
Private Sub Command2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Timer1.Interval = 100
'load somthing int the 5 lists
For i = 0 To 4
For j = 1 To 10
List1(i).AddItem "item " & j
Next j
Next i
End Sub
Private Sub Timer1_Timer()
Static i As Integer
Dim j As Integer
i = List1(0).ListIndex
Select Case direction
Case UP
If i > 0 Then
List1(0).ListIndex = i - 1
End If
Case DOWN
If i < List1(0).ListCount - 1 Then
List1(0).ListIndex = i + 1
End If
End Select
'now sycnchronise the lists
For j = 1 To 4
List1(j).TopIndex = List1(0).TopIndex
Next j
End Sub
-
Hiya,
Thanks for your help on Q1. =)
How do you insert a List View? Do I have to enable it in the components so it appears in the toolbar, because I can't see it there... (in the comp. window I mean)
-Git
-
Yeah, listview is in
Mircosoft Windows Common Controls
on the menu click:
Project -> Components
and select "Mircosoft Windows Common Controls" from the list
Listviews seem a bit odd the first time you use one.
Do a search for listview on this forum and you will find plenty of examples how top use them
-
Ok, thanks for your help. =)
Cya,
-Git