[Lazarus] Synchronize scrollposition of two stringgrids

Sven Barth pascaldragon at googlemail.com
Tue Oct 16 20:44:54 CEST 2012


On 16.10.2012 08:55, Rimmert Ooink wrote:
> On Tue, Oct 16, 2012 at 1:54 AM, Jesus Reyes <jesusrmx at yahoo.com.mx
> <mailto:jesusrmx at yahoo.com.mx>> wrote:
>
>      >Does anybody have an idea how to change the scrollposition of a
>     stringgrid depending on the scrollpos of the other?
>
>     sg1.LeftCol := sg2.LeftCol;
>     sg1.TopRow:=sg2.TopRow;
>
>     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 :)
>
> LeftCol works like described.
>
> I also want to try the Get/SetScrollInfo, but I noted it is defined in
> winapih, does that mean its Windows only?
> Ifso, i'll stick with using Leftcol.

winapih only means that this is the file where the declarations of the 
Windows API functions reside which are used (and implemented) by the LCL 
on all plattforms (even on Windows the routines there are forwarders to 
the real Win API functions). So if Get-/SetScrollInfo is implemented and 
works for e.g. Carbon you can use it.

Regards,
Sven





More information about the Lazarus mailing list