Results 1 to 5 of 5

Thread: List box scroll question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153

    Wink

    is it possible to scroll one list box and at the same time scroll another..........

    This would work two way to the list boxes are appear joined?

  2. #2
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    You can use various api calls to set the top visible index (post a message with LB_SETTOPINDEX) etc. Is this the sort of thing your after?
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153

    I think it is any idea what the api is

    thats right, any idea what the api call is?

  4. #4
    Hyperactive Member tumblingdown's Avatar
    Join Date
    Mar 2000
    Posts
    362
    pardon?

    if your asking what i think your saying then...

    There are a bunch of messages you can send to windows using the api calls PostMessage and SendMessage, i.e.

    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    where...
    hwnd: is the handle of your listbox
    wMsg: is the message you will send
    ( e.g. declare the message LB_SETTOPINDEX by
    Const LB_SETTOPINDEX = &H197 )
    wParam: is the entry (index - zero based) of the entry you want to appear at the top of the listbox
    lParam: set to zero

    There are a bunch of other messages you can also use to have more control.

    Hope this helps.
    "One logical slip and an entire scientific edifice comes tumbling down." - Robert M. Pirsig


    [email protected]

    "but if Einstein is right and God is in the details, reality requires that we sometimes get religion." - Scott Meyers.

  5. #5
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Someone asked this question a while ago, and this was the answer. Not mine i might add.

    use the TopIndex property. If the lists do not have the same number of items you will need to make sure the topindex is not greater than the listcount.

    Otherwise, two identical lists will scroll together perfectly.

    Code:
    Private Sub List1_Scroll()
      List2.TopIndex = List1.TopIndex
    End Sub
    
    Private Sub List2_Scroll()
      List1.TopIndex = List2.TopIndex
    End Sub
    Iain, thats with an i by the way!

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