[Lazarus] Synchronize scrollposition of two stringgrids

Jesus Reyes jesusrmx at yahoo.com.mx
Tue Oct 16 01:54:10 CEST 2012

>I have two stringgrids with exactly the same columns, basically something like Excel autofilter.

>Does anybody have an idea how to change the scrollposition of a stringgrid depending on the scrollpos of the other?

One way would be using OnSelection event and try something like:

sg1.LeftCol := sg2.LeftCol;

sg1 will be synchronized to sg2.

That would give you row/col size granularity. For pixel granularity, without messing with grids internals, could be done using GetScrollInfo for both scrollbars on source grid and using SetScrollInfo for both scrollbars on target grid. Not tried but should work :)

Jesus Reyes A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20121015/e3153fc5/attachment-0003.html>

More information about the Lazarus mailing list