Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to synchronize vertical scrolling of two listview?

Status
Not open for further replies.

junwebhead

Programmer
Jun 13, 2003
41
QA
Hi everybody!
I've been trying to simulate the freeze pane function just like in excel using two listview controls. What I did initially is to subclass WM_VSCROLL message of the first listview and then send that message to the other. But my problem is when I drag the scroll bar of the first listview, the other listview is not responding. I also want to synchronize the scrolling when the user uses the mouse wheel. For now, what I did to avoid confusion in my application is to disable the WM_WHEEL and trap the WM_VSCROLL message when the user drags the scroll bar in scrolling. Please help me how to overcome these problems.
Thanks in advance!

Jun
 
I did this with 5 listboxes, neve with listview... if you want the code of the listboxes just let me know.
 
Try this in the list boxes scroll events. There is a slight delay but it should work.
Code:
Private Sub List1_Scroll()
   List2.TopIndex = List1.TopIndex
End Sub

Private Sub List2_Scroll()
   List1.TopIndex = List2.TopIndex
End Sub


zemp
 
thanks for all your help. I found a code that does what I want. But it is written in C++. I'll just have to study the code in detail for it to work in VB. Thanks!

Jun
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top