On Tue, Oct 16, 2012 at 8:55 AM, Rimmert Ooink <laza...@ooink.net> wrote:
> On Tue, Oct 16, 2012 at 1:54 AM, Jesus Reyes <jesus...@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;
>>
>> 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.

Anybody an idea why the code below doesn't work?
GetScrollBarPosition does seem to return the correct value, but the
call to ScrollbarPosition doesn't seem to work.
On windows it actually cals SetScrollInfo as mentioned, but doesn't
seem to do anything.

Thanks!

type
  TGridHack = class(TStringGrid)
  public
    procedure SyncTo(grd: TStringGrid);
  end;

implementation

{ TGridHack }

procedure TGridHack.SyncTo(grd: TStringGrid);
begin
  //LeftCol := grd.LeftCol;
  ScrollBarPosition(SB_Horz, TGridHack(grd).GetScrollBarPosition(SB_Horz));
  //ScrollBarPosition(SB_Vert, TGridHack(grd).GetScrollBarPosition(SB_Vert));
end;

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to