scrollen von listview

  • hallo ihr lieben habe leider folgendes problem . ich habe eine gui mit 3listviews mit scrollbalken.

    wenn inder ersten listview der scrollbalken bewegt wird sollen die anderen beiden syncron scrollen

    leider komme ich in moment nicht weiter


    hier ist mein ansatz

    Spoiler anzeigen
    [autoit]


    ; Script Start - Add your code below here
    ##include<SendMessage.au3>
    #include<WindowsConstants.au3>
    #include<StructureConstants.au3>
    #include<ListViewConstants.au3>
    #include <GuiListView.au3>
    Global $hGUI, $hList1, $hList2
    $Form = GUICreate("Testing scroll",800, 600)
    $hList1 = _GUICtrlListView_Create($Form, "", 0, 40, 312, 598);filename
    $hList2 = _GUICtrlListView_Create($Form, "", 313, 40, 150, 598);filegrösse
    $hList3 =_GUICtrlListView_Create($Form, "", 465, 40, 200, 598);datum
    _GUICtrlListView_AddColumn($hList1, "filename", 292)
    _GUICtrlListView_AddColumn($hList2, "grösse", 100)
    _GUICtrlListView_AddColumn($hList3, "datum", 200)
    GUISetState()
    For $i = 1 To 500
    _GUICtrlListView_AddItem($hList1, $i, 0)
    _GUICtrlListView_AddItem($hList2, $i, 0)
    _GUICtrlListView_AddItem($hList3, $i, 0)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    While GUIGetMsg() <> -3
    WEnd

    [/autoit]


    das habe ich durch die suche gefunden

    Spoiler anzeigen
    [autoit]


    ##include<SendMessage.au3>
    #include<WindowsConstants.au3>
    #include<StructureConstants.au3>
    #include<ListViewConstants.au3>
    Global $hGUI, $hList1, $hList2
    $hGUI = GUICreate("Testing scroll",800, 600)
    $hList1 = GUICtrlCreateListView("List view 1", 2, 2, 248, 596)
    $hList2 = GUICtrlCreateListView("List view 2", 253, 2, 249, 596)
    $hList3 = GUICtrlCreateListView("List view 3",500, 2, 249, 596)
    GUISetState()
    For $i = 1 To 500
    GUICtrlCreateListViewItem($i, $hList1)
    GUICtrlCreateListViewItem($i, $hList2)
    GUICtrlCreateListViewItem($i, $hList3)
    Next
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    While GUIGetMsg() <> -3
    WEnd
    Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    If DllStructGetData($tNMHDR, "code") <> $LVN_ENDSCROLL Then Return
    Local $hListFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    Local $tNMLVSCROLL = DllStructCreate($tagNMLVSCROLL, $lParam)
    If $hListFrom = GUICtrlGetHandle($hList1) Then
    GUICtrlSendMsg($hList2, $LVM_SCROLL, DllStructGetData($tNMLVSCROLL, "dx"), DllStructGetData($tNMLVSCROLL, "dy") * 16)
    GUICtrlSendMsg($hList3, $LVM_SCROLL, DllStructGetData($tNMLVSCROLL, "dx"), DllStructGetData($tNMLVSCROLL, "dy") * 16)
    EndIf
    EndFunc ;==>WM_NOTIFY_GUICtrlListView_Scroll($hWnd, $iDX, $iDY)

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    bekomme das aber nicht auf meine gui hin

    danke für jede hilfe

    Einmal editiert, zuletzt von sillyboy (13. April 2011 um 16:40)

  • Hi,
    so gehts

    Spoiler anzeigen
    [autoit]

    #include<SendMessage.au3>
    #include<WindowsConstants.au3>
    #include<StructureConstants.au3>
    #include<ListViewConstants.au3>
    #include <GuiListView.au3>
    #AutoIt3Wrapper_UseX64=n
    Global $hGUI, $hList1, $hList2
    $Form = GUICreate("Testing scroll", 800, 600)
    $cList1 = GUICtrlCreateListView("", 0, 40, 312, 598);filename
    $cList2 = GUICtrlCreateListView("", 313, 40, 150, 598);filegrösse
    $cList3 = GUICtrlCreateListView("", 465, 40, 200, 598);datum
    $hList1 = GUICtrlGetHandle($cList1)
    $hList2 = GUICtrlGetHandle($cList2)
    $hList3 = GUICtrlGetHandle($cList3)
    _GUICtrlListView_AddColumn($hList1, "filename", 292)
    _GUICtrlListView_AddColumn($hList2, "grösse", 100)
    _GUICtrlListView_AddColumn($hList3, "datum", 200)
    GUISetState()
    For $i = 1 To 500
    _GUICtrlListView_AddItem($hList1, $i, 0)
    _GUICtrlListView_AddItem($hList2, $i, 0)
    _GUICtrlListView_AddItem($hList3, $i, 0)
    Next
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    While GUIGetMsg() <> -3
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    If DllStructGetData($tNMHDR, "code") <> $LVN_ENDSCROLL Then Return
    Local $hListFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    Local $tNMLVSCROLL = DllStructCreate($tagNMLVSCROLL, $lParam)
    If $hListFrom = $hList1 Then
    GUICtrlSendMsg($cList2, $LVM_SCROLL, DllStructGetData($tNMLVSCROLL, "dx"), DllStructGetData($tNMLVSCROLL, "dy") * 16)
    GUICtrlSendMsg($cList3, $LVM_SCROLL, DllStructGetData($tNMLVSCROLL, "dx"), DllStructGetData($tNMLVSCROLL, "dy") * 16)
    EndIf
    EndFunc ;==>WM_NOTIFY

    [/autoit]