unit Unit1;
interface
//201011 Thomas Wassermann
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,jpeg, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
ScrollBar1: TScrollBar;
procedure ALLMemoChange(Sender: TObject);
procedure ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
private
Function CalcMaxScrollRange:Integer;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function TForm1.CalcMaxScrollRange:Integer;
var
i:Integer;
begin
Result := 0;
for I := 0
to ComponentCount -1
do
if Components[i]
is TMemo
then
if TMemo(Components[i]).Lines.Count > Result
then Result := TMemo(Components[i]).Lines.Count;
end;
procedure TForm1.ALLMemoChange(Sender: TObject);
begin
ScrollBar1.Max := CalcMaxScrollRange;
end;
procedure TForm1.ScrollBar1Scroll(Sender: TObject; ScrollCode: TScrollCode;
var ScrollPos: Integer);
var
i:Integer;
begin
for I := 0
to ComponentCount -1
do
if Components[i]
is TMemo
then
with TMemo(Components[i])
do
begin
SelStart := Perform(EM_LINEINDEX, ScrollPos, 0);
Perform(EM_SCROLLCARET, 0, 0);
end;
end;
end.