Page 1 of 1
					
				Scroll two ExplorerListView together
				Posted: 27 Feb 2014, 13:20
				by namalyaya@gmail.com
				Hello  

 , I want to Scroll two ExplorerListView with together.
Can you explain, how do that.  

 
			
					
				Re: Scroll two ExplorerListView together
				Posted: 28 Feb 2014, 19:08
				by TiKu
				Hi,
Right now I don't have the time to create a sample project, but it should be easy. I'd subclass both controls and watch for WM_VSCROLL and WM_HSCROLL messages. Then I would duplicate these messages and send them to the slave control. To identify master and slave control, you could use GetCursorPos and WindowFromPoint and declare the control with the mouse cursor in it as the master control.
Hope this helps
TiKu
			 
			
					
				Re: Scroll two ExplorerListView together
				Posted: 08 Mar 2014, 08:19
				by namalyaya@gmail.com
				Thanks  

  Tiku Spend your time for answer  

 . but I am not genius of Programming  

 . So I haven't knowledge about sub class  

 . do you can provide any similar post link which I can understand your solution.  

 
			
					
				Re: Scroll two ExplorerListView together
				Posted: 08 Mar 2014, 10:22
				by TiKu
				I'll put something together tomorrow.
			 
			
					
				Re: Scroll two ExplorerListView together
				Posted: 08 Mar 2014, 10:27
				by namalyaya@gmail.com
				Thanks TiKu again.  

 
			
					
				Re: Scroll two ExplorerListView together
				Posted: 09 Mar 2014, 18:40
				by TiKu
				This seems to be more difficult than expected. The best solution I could find doesn't involve sub-classing at all. Instead it uses the AfterScroll event:
Code: Select all
Option Explicit
Private Sub Form_Load()
  Dim i As Long
  
  lv1.View = vDetails
  lv1.Columns.Add "Column 1", , 300
  For i = 1 To 100
    lv1.ListItems.Add "Item " & CStr(i)
  Next i
  lv2.View = vDetails
  lv2.Columns.Add "Column 1", , 300
  For i = 1 To 100
    lv2.ListItems.Add "Item " & CStr(i)
  Next i
End Sub
Private Sub lv1_AfterScroll(ByVal dx As Long, ByVal dy As Long)
  If lv1.Tag = "" Then
    If lv1.View = vDetails Then
      lv2.Tag = 1
      lv2.Scroll dx, dy * (lv2.ItemHeight + 2)
      lv2.Tag = ""
    End If
  End If
End Sub
Private Sub lv2_AfterScroll(ByVal dx As Long, ByVal dy As Long)
  If lv2.Tag = "" Then
    If lv2.View = vDetails Then
      lv1.Tag = 1
      lv1.Scroll dx, dy * (lv1.ItemHeight + 2)
      lv1.Tag = ""
    End If
  End If
End Sub
The problem with this approach is, that it doesn't synchronize all scroll events. For instance it won't catch the scrolling that is involved when selecting items by keyboard (arrow keys etc.)
Regards
TiKu