Height is scrollable area is divisible by rve.VSmallStep property.
By default it is 10.
So, for example, if document height is 23, the height of srollable area is 30. In addition, rve.Height includes border width.
So, assign rve.VSmallStep := 1 before calling rve.Format, and use rve.ClientHeight instead of rve.Height.
procedure TForm1.rveResize(Sender: TObject);
var
c: Integer;
begin
rve.OnResize := nil;
try
c := Trunc(rve.DocumentHeight / rve.VSmallStep);
if (rve.DocumentHeight mod rve.VSmallStep) > 0 then
c := c + 1;
rve.ClientHeight := rve.VSmallStep * c// Now height of rve is equal to height of scrollable area?
finally
rve.OnResize := rveResize;
end;
end;
I'm use OnResize event because it's fired when user press Enter key or remove line.
But scroll bar is still active. If I call rve.Format than scrollbar will be deactive, but carret will move to beginning of document.
Where I must call Format and assign VSmallStep to 1?
c := Trunc(rve.DocumentHeight / rve.VSmallStep);
if (rve.DocumentHeight mod rve.VSmallStep) > 0 then
c := c + 1;
rve.ClientHeight := rve.VSmallStep * c// Now height of rve is equal to height of scrollable area?
Is something like this still necessary? According to the help file, DocumentHeight is already a multiple of VSmallStep.
The help file is wrong, I'll correct it.
While the height of a scrollable area is really a multiple of VSmallStep, DocumentHeight is not. This is the exact document height.
Sergey Tkachenko wrote:The help file is wrong, I'll correct it.
While the height of a scrollable area is really a multiple of VSmallStep, DocumentHeight is not. This is the exact document height.