(SOLVED) Synchronize the horizontal scrollbar of two stringgrids lazarus / 21-General ---------------------------------------------------------------------- xinyiman · 2021-09-09 20:14 Hi guys, I need to synchronize the horizontal scrolling of two stringgrids. To make a kind of footer for the main grid. I enclose a small example. Just run the program and then use the gridbody scrollbar. As you can see it does not sync properly as I would like. Anyone suggest me how to do it? A thousand thanks ---------------------------------------------------------------------- winni · 2021-09-09 20:47 Hi! Project is damaged. No Source, no form. Winni ---------------------------------------------------------------------- MarkMLl · 2021-09-09 21:06 Quote from: winni on September 09, 2021, 10:47:28 pmHi! Project is damaged. No Source, no form. Winni What version are you opening it with? .lfm shows 2.3.0, so it's susceptible to the format change that breaks earlier versions. MarkMLl ---------------------------------------------------------------------- xinyiman · 2021-09-10 06:33 Hi, your code synchronizes the position of the scrollbar, but does not synchronize the scrolling of the columns in turn. If I move the scrollbar, the columns between the two grids are not aligned. I want to scroll and see the columns as if they were of a single stringgrid. Because later I will hide the scrollbar of the footer grid. ---------------------------------------------------------------------- wp · 2021-09-10 09:27 Quote from: xinyiman on September 09, 2021, 10:14:51 pmAs you can see it does not sync properly as I would like. Anyone suggest me how to do it? Turn off the option goSmoothScroll of both grids to avoid truncating the left cell. You can keep the footer scrollbar when you add an OnTopLeftChange handler for the footer grid so that the body grid synchronizes with the footer grid: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.GridBodyTopLeftChanged(Sender: TObject);begin  GridFooter.LeftCol := GridBody.LeftCol;end; procedure TForm1.GridFooterTopLeftChanged(Sender: TObject);begin  GridBody.LeftCol := GridFooter.LeftCol;end; ---------------------------------------------------------------------- xinyiman · 2021-09-10 09:56 Quote from: wp on September 10, 2021, 11:27:26 amQuote from: xinyiman on September 09, 2021, 10:14:51 pmAs you can see it does not sync properly as I would like. Anyone suggest me how to do it? Turn off the option goSmoothScroll of both grids to avoid truncating the left cell. You can keep the footer scrollbar when you add an OnTopLeftChange handler for the footer grid so that the body grid synchronizes with the footer grid: Perfect. Thank you.