Automatisches scrollen in Listview

  • Hallo zusammen,
    ich habe eine GUI mit einer Listview und einem Button. Jedesmal wenn ich den
    Button drücke wird durch die Items der Listview geblättert. Das aktuelle Item
    bekommt dann immer eine Markierung. Leider ist es nun so, dass die Listview nicht automatisch
    mitscrollt. Die Hilfe hat mich leider nicht weitergebracht. Kann mir hier einer weiterhelfen?
    Das ist mein Skript:

    Spoiler anzeigen
    [autoit]

    #Include <GuiListView.au3>
    #include <GUIConstants.au3>
    #include <Array.au3>

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

    Dim $array[11][2]
    $array[0][0] = "a"
    $array[0][1] = "a2"
    $array[1][0] = "b"
    $array[1][1] = "b2"
    $array[2][0] = "c"
    $array[2][1] = "c2"
    $array[3][0] = "d"
    $array[3][1] = "d2"
    $array[4][0] = "e"
    $array[4][1] = "e2"
    $array[5][0] = "f"
    $array[5][1] = "f2"
    $array[6][0] = "g"
    $array[6][1] = "g2"
    $array[7][0] = "h"
    $array[7][1] = "h2"
    $array[8][0] = "i"
    $array[8][1] = "i2"
    $array[9][0] = "j"
    $array[9][1] = "j2"
    $array[10][0] = "k"
    $array[10][1] = "k2"

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

    $gui = GUICreate("gui", 450, 450)
    GUISetState(@SW_SHOW)
    $index = 0
    $listview = GUICtrlCreateListView("Spalte1|Spalte2", 20, 30, 200, 150)
    For $i = 0 To UBound($array) - 1
    GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $listview)
    Next
    $button = GUICtrlCreateButton("next element", 75, 300, 90, 30)
    Do
    $msg = GUIGetMsg()
    Select
    Case $msg = $button
    $read = _GUICtrlListView_GetItemTextString($listview, $index)
    $index += 1
    _GUICtrlListView_SetItemSelected(GUICtrlGetHandle($listview), $index-1, False) ; Vorherigem Element Markierung entziehen
    _GUICtrlListView_SetItemSelected(GUICtrlGetHandle($listview), $index, True) ; Aktuelles Element markieren
    If $index >= _GUICtrlListView_GetItemCount($listview) Then $index = 0
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE

    [/autoit]
  • Spoiler anzeigen
    [autoit]

    #Include <GuiListView.au3>
    #include <GUIConstants.au3>
    #include <Array.au3>

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

    Dim $array[11][2]
    $array[0][0] = "a"
    $array[0][1] = "a2"
    $array[1][0] = "b"
    $array[1][1] = "b2"
    $array[2][0] = "c"
    $array[2][1] = "c2"
    $array[3][0] = "d"
    $array[3][1] = "d2"
    $array[4][0] = "e"
    $array[4][1] = "e2"
    $array[5][0] = "f"
    $array[5][1] = "f2"
    $array[6][0] = "g"
    $array[6][1] = "g2"
    $array[7][0] = "h"
    $array[7][1] = "h2"
    $array[8][0] = "i"
    $array[8][1] = "i2"
    $array[9][0] = "j"
    $array[9][1] = "j2"
    $array[10][0] = "k"
    $array[10][1] = "k2"

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

    $gui = GUICreate("gui", 450, 450)
    GUISetState(@SW_SHOW)
    $index = 0
    $listview = GUICtrlCreateListView("Spalte1|Spalte2", 20, 30, 200, 150)
    For $i = 0 To UBound($array) - 1
    GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $listview)
    Next
    $button = GUICtrlCreateButton("next element", 75, 300, 90, 30)
    Do
    $msg = GUIGetMsg()
    Select
    Case $msg = $button
    $read = _GUICtrlListView_GetItemTextString($listview, $index)
    $index += 1
    _GUICtrlListView_SetItemSelected(GUICtrlGetHandle($listview), $index-1, False) ; Vorherigem Element Markierung entziehen
    _GUICtrlListView_SetItemSelected(GUICtrlGetHandle($listview), $index, True) ; Aktuelles Element markieren
    If $index >= _GUICtrlListView_GetItemCount($listview) Then $index = 0
    _GUICtrlListView_EnsureVisible(GUICtrlGetHandle($listview), $index)
    EndSelect
    Until $msg = $GUI_EVENT_CLOSE

    [/autoit]
  • EnsureVisible... :pinch:
    Ich danke dir. Mal eine Frage wo finde ich denn die Includes vom Autoit? Dann könnte ich mir die Funktionen mal direkt anschauen.Also zum Beispiel: #Include <GuiListView.au3>

  • Alle "hellblauen" Funktionen kann man sich direkt mit CTRL-J (Prod) oder CTRL-ALT-J (Beta) anschauen und ggf auf seine eigenen Bedürfnisse zurechtschnitzen, zurückspringen ins Script funktioniert mit CTRL-Shift-J

    Im Bearbeiten- und Extras-Menü in Scite sind die wahren AutoIt-Schätze versteckt...