[Lazarus] Inconsistent ScrolledClientRect calculation

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Oct 7 13:33:18 CEST 2011


Mattias Gaertner schrieb:

> ClientRect Left,Top is 0,0, so Right=ClientWidth and Bottom=ClientHeight.

What about the determination of the ScrollOffset:

function TScrollingWinControl.GetClientScrollOffset: TPoint;
begin
   if (HorzScrollBar <> nil) and (VertScrollBar <> nil) then
   begin
     Result.X := HorzScrollBar.Position;
     Result.Y := VertScrollBar.Position;
   end else
   begin
     Result.X := 0;
     Result.Y := 0;
   end;
end;

Does a scrolling control really *always* have two or zero scrollbars?
If so, a check of only one scrollbar would be sufficient,
otherwise every scrollbar must be checked individually!

DoDi





More information about the Lazarus mailing list