bazzer747 25 Posted June 10, 2021 Alongside each other on a form I have a CheckList and a ListBox. As I scroll down the CheckList (on the left side) box I want the ListBox (on the right side) to also scroll down, but at half the speed. The left side has 64 rows (col height 30) , the right side 32 rows (col height 60). As the scrolling goes through the 64 rows on the left side two rows at a time I want the right side to scroll down one row at a time. The application monitors progress of a knockout competition. Currently I try this using the following procedures to synchronise the vertical scrolling: procedure TForm1.Grid1WindowProc(var Message: TMessage); begin OldGridProc1(Message); if ((Message.Msg = WM_VSCROLL)) then OldGridProc2( Message ); end; procedure TForm1.Grid2WindowProc(var Message: TMessage); begin OldGridProc2( Message ); if (( Message.Msg = WM_VSCROLL )) then OldGridProc1( Message ); end; In the form activate I have this: OldGridProc1:= sgLastRound.WindowProc; sgLastRound.WindowProc := Grid1WindowProc; OldGridProc2:= gsgNextRound.WindowProc; gsgNextRound.WindowProc:= Grid2WindowProc; And this works correctly scrolling each side BUT at the same amount. What I'm after is the right side to scroll at half the amount of the left side. I can't see where I can divide the right side movement by 2 so it goes half the distances. Sorry if this isn't that clear. The attached screenshot may help visualise the problem. Share this post Link to post
Anders Melander 1815 Posted June 10, 2021 Why not just set the absolute scollbar position of the listbox based on the position of the checklist scrollbar position? Share this post Link to post
Pat Foley 52 Posted June 10, 2021 How about using buffer items in second--These would be blank or ad space :)--but stay at 30 for height unless there is a way to insert a 15 height buffer first to center second items displays. TWinStatus = (WSallin,WSsecondround..WSoverallwinner) TTeam = record name: string; Lastwin: TwinStatus end; Teams, Opposers, Winners: Tlist; end; Teams: tlist; //build the controls.items at runtime // round := WSallin; //add half height dummy to second list if possible with Teams do begin if TTteam(items[ii]).Lastwin := round then add to listbox1.items if TTteam(items[ii]).Lastwin := TwinStatus(round + 1) then begin add to listbox2.items add dummy to listbox2.items end; end; Share this post Link to post