How to synchronize list-box scroll positions?

Get help with using AutoHotkey and its commands and hotkeys
JackPJ
Posts: 18
Joined: 19 Oct 2016, 05:52

How to synchronize list-box scroll positions?

26 Oct 2016, 07:38

Hi all,

I have a 5 list-boxes side by side, which all have an array with the same amount of items in it.

Currently, i can make it so all list boxes highlight the same row when you click one, but I cant get the scrollbars to synchronize. i.e if I manually scroll down one box and select an item, the others will only scroll as far is necessary for it to display and then highlight it. This leaves them de-synced on screen. And I can almost guarantee my end users wont even click one half the time and expect the scroll bars to just match up when you scroll one :(

I'm not asking for someone to do this for me, otherwise I wouldn't learn anything, but some pointers towards what commands to use or how to go about it would be greatly appreciated.


An example of my code is below. List1-5 are all the same length.

Code: Select all

Gui, Add, ListBox, x5   y350 w100 h340 AltSubmit gNomSelect3 vcolorchoice3 Choose1 -TabStop, %list3%
Gui, Add, ListBox, x110 y350 w250 h330 AltSubmit gNomSelect1 vcolorchoice1 Choose1 -TabStop, %list1%
Gui, Add, ListBox, x365 y350 w70  h340 AltSubmit gNomSelect2 vcolorchoice2 Choose1 -TabStop, %list2%

Gui, Add, ListBox, x440 y350 w475 h340 AltSubmit gNomSelect4 vcolorchoice4 Choose1 -TabStop, %list4%
Gui, Add, ListBox, x920 y350 w100 h340 AltSubmit gNomSelect5 vcolorchoice5 Choose1 -TabStop, %list5%

NomSelect1:
gui, submit, nohide

row := colorchoice1

GuiControl, choose, colorchoice2, %row%
GuiControl, choose, colorchoice3, %row%
GuiControl, choose, colorchoice4, %row%
GuiControl, choose, colorchoice5, %row%

return
NomSelect2:
gui, submit, nohide

row := colorchoice2

GuiControl, choose, colorchoice1, %row%
GuiControl, choose, colorchoice3, %row%
GuiControl, choose, colorchoice4, %row%
GuiControl, choose, colorchoice5, %row%

return
NomSelect3:
gui, submit, nohide

row := colorchoice3

GuiControl, choose, colorchoice2, %row%
GuiControl, choose, colorchoice1, %row%
GuiControl, choose, colorchoice4, %row%
GuiControl, choose, colorchoice5, %row%

return
NomSelect4:
gui, submit, nohide

row := colorchoice4

GuiControl, choose, colorchoice2, %row%
GuiControl, choose, colorchoice3, %row%
GuiControl, choose, colorchoice1, %row%
GuiControl, choose, colorchoice5, %row%

return
NomSelect5:
gui, submit, nohide

row := colorchoice5

GuiControl, choose, colorchoice2, %row%
GuiControl, choose, colorchoice3, %row%
GuiControl, choose, colorchoice4, %row%
GuiControl, choose, colorchoice1, %row%

return
Many Thanks

Jack

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], hughman, john68, VonVon and 185 guests