Thanx engkin,
The texts in two editors are scrolling perfect inline.
but... the right scrollbar dosen't move until on MouseUp ..Just a minor problem.
This may be to help for others so i put a complet demo-code here:
Drop two LzRichEditors on a form. (May be ok in other RichEditors too)
Put in Uses: Windows, LMessages
unit Unit1;
{$mode objfpc}{$H+}
interface
uses Windows,
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, lzRichEdit,
LMessages;
type
{ TForm1 }
TForm1 = class(TForm)
lzRichEdit1: TlzRichEdit;
lzRichEdit2: TlzRichEdit;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
OrgMemoWndProc: TWndMethod;
procedure MemoWndMethod(var TheMessage: TLMessage);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
OrgMemoWndProc := lzRichEdit1.WindowProc;
lzRichEdit1.WindowProc := @MemoWndMethod
end;
procedure TForm1.MemoWndMethod(var TheMessage: TLMessage);
begin
OrgMemoWndProc1(TheMessage);
if TheMessage.msg = LM_VSCROLL then
SendMessage(lzRichEdit2.Handle, WM_VSCROLL, TheMessage.wParam, TheMessage.lParam);
if TheMessage.wParamlo = SB_THUMBTRACK then
SetScrollPos(lzRichEdit2.Handle, SB_VERT, TheMessage.wParamhi, True);
end;
end.
......
And, yes, the Delphi-code is just as shown abow, compiles and run ok. Has been in use a lot of years.
But with the .... @RichEdWndProc ... does not compile in Lazarus ..
main.pas(302,43) Error: Incompatible type for arg no. 1: Got "Pointer", expected "<procedure variable type of function(LongWord,LongWord,LongInt,LongInt):LongInt;StdCall>"
Not important, ...