TControl.ScrolledClientRect offsets *all* fields in the TRect by the scroll offsets. This is *incorrect*, when the TRect is initialized to ClientRect, where the second set of coordinates is the Width and Heigth, not the BottomRight corner of the area. Obviously Width and Height are insensitive to scrolling!

The ambiguous use of TRect, with either BottomRight or WidthHeight in the second TPoint, often leads to misunderstandings and flawed code (as above). It were helpful when type alias would be introduced and used, or when the argument names would indicate the current content of an TRect.

E.g. in the EasyDockManager I use XYWH or TLBR for the argument names, to clarify the content of the passed TRect.

DoDi


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to