Results 1 to 6 of 6

Thread: Scrollbars and ListBoxes

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225

    Question

    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

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    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

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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
    Mark
    -------------------

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    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

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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


    Mark
    -------------------

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    Ok, thanks for your help. =)

    Cya,

    -Git

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width