As requested here
http://www.autohotkey.com/forum/viewtopic.php?t=44855
(didn't need sendmessage after all it occured to me)
Code:
; [Example] Endless scrolling in a listview
; an example of a listviw which you can endlessly scroll, after
; it reaches the last item in the listviw it jumps back the
; first and vice versa
; See also
; [Example] Endless scrolling in a listbox
; http://www.autohotkey.com/forum/topic31618.html
;
GUITitle=Endless Listview
Gui, add, ListView, w200 h200,1|2
Loop 50
{
LV_Add("",A_Index,A_Index)
}
LV_ModifyCol(1, 30)
LV_ModifyCol(2, 30)
Gui, Show,, %GUITitle%
Return
#IfWinActive, Endless Listview
Up::
PreviousPos:=LV_GetNext()
If (PreviousPos = 0) ; exeption, focus is not on listview this will allow you to jump to last item via UP key
{
ControlSend, SysListview321, {End}, %GUITitle%
Return
}
ControlSend, SysListview321, {Up}, %GUITitle%
ItemsInList:=LV_GetCount()
ChoicePos:=PreviousPos-1
If (ChoicePos <= 1)
ChoicePos = 1
If (ChoicePos = PreviousPos)
ControlSend, SysListview321, {End}, %GUITitle%
Return
Down::
PreviousPos:=LV_GetNext()
ControlSend, SysListview321, {Down}, %GUITitle%
ItemsInList:=LV_GetCount()
ChoicePos:=PreviousPos+1
If (ChoicePos > ItemsInList)
ChoicePos := ItemsInList
If (ChoicePos = PreviousPos)
ControlSend, SysListview321, {Home}, %GUITitle%
Return
#IfWinActive
GuiEscape: ; ESC
GuiClose: ; Program is closed
ExitApp
See also
[Example] Endless scrolling in a listbox
http://www.autohotkey.com/forum/topic31618.html