This issue has been brought up multiple times over the past many years, but none of the suggested solutions seem to work. Therefore I will bring it up again and add as detailed info as possible, in the hope that someone will be able to reproduce it and find a real solution.
I need to scroll the text in a TMemo automatically.
To do this I set the value of TMemo.VertScrollBox.Position.
Setting Position moves the thumb of the ScrollBar, but the text does not scroll.
I am using Lazarus version 1.4.2, FreePascal version 2.6.4, and I am compiling and executing the program on Windows 8 ver 6.3.
Please note that I have tried this on earlier versions of Lazarus and Windows with the same result.
I have not tried it on Linux, so it might be a Windows only problem.
Here is a quick program which shows the problem:
Create a new application.
Add a Tmemo and a TButton on the form.
Set the TMemo.ScrollBars property to ssAutoVertical.
Create a OnPress handler for the TButton.
Create a OnCreate handler for the TForm.
Enter this code in the two handlers:
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.VertScrollBar.Position:=Memo1.VertScrollBar.Position+1;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i:integer;
begin
for i:=1 to 99 do
Memo1.Lines.Add(format('Line %d', [i]));
end;
Now run the program, and press the button a number of times.
If it works like it does for me, then you will notice that the thumb of the scroll bar moves down, but the text doesn't scroll.
Now move the mouse over the thumb, and give it a click, you will now see that the text jumps to the line which matches the scroll bar position.
The attached png shows two screen shots of the program.
On the left screen shot I pressed the button 46 times, so the thumb is half way down the scroll bar, but the text field still shows the top line.
On the right screen shot the scroll bar is still at position 46, and I have clicked the thumb with the mouse. Now the text field is aligned with the scroll bar and top line is line 46.
I really hope someone can fix this, or come up with a decent workaround, because my current workaround is a bit of a pain.