You need to sign in or sign up before continuing.
TScrollbox makes IDE unusable if the Scrollbar.Range is very large
- Lazarus/FPC Version: Lazarus 2.3.0 (rev main-2_3-1863-g0de5404e) FPC 3.2.2 i386-win32-win32/win64
- Operating System: Win 11 (64 bit)
- CPU / Bitness: any
What happens
When the Range
of the HorzScrollbar
and/or VertScrollbar
of a TScrollbox
is set to a large value (e.g. 10000), a component is dropped on the scrollbox or the scrollbox is dragged to a different place or changed in size, the IDE becomes non-responsive for several seconds.
What did you expect
The Range of the scrollbars should not have an impact on the performance of the IDE.
Steps to reproduce
- Drop a
TScrollbox
on a form - Set its
HorzScrollbar.Range
and itsVertScrollbar.Range
to 10000. - Drag the scrollbox to a slightly different place --> The IDE seems to hang, but restores itself after several seconds. This repeats whenever the scrollbox is repainted.
Analysis
This issue was reported in a post of the German Lazarus forum by user siro (https://www.lazarusforum.de/viewtopic.php?p=129700). Here are the most important findings reported there:
- Turn off the "Show Grid" option in "IDE Options" > "Form Editor" --> IDE remains fast in the "Steps to reproduce"
- It is a design-time issue only. The project created by the "Steps to reproduce" behaves normally at run-time.
- The issue is caused by the method
TDesigner.PaintClientGrid
(unitdesigner
, folder "designer) which calls the widgetset functionDrawGrid()
with the scrollbox'sGetLogicalClientRect
as an argument. This rectangle is the rectangle spanned by the scrollbar'sRange
property values. Therefore a very large number of points must be drawn in our case although only a small window is visible. - Testing with Laz 1.4.4 reveals that the issue did not exist there. In this version
DrawGrid()
had been called with the scrollbar'sClientRect
as an argument, rather than with itsGetLogicalClientRect
. - The change which replaced the
ClientRect
byGetLogicalClientRect
was the commit ef6fdb4d, "Designer: Bug fix for DrawGrid. Use LogicalClientRect instead of ClientRect. r49385 from free-sparta branch by Maciej Izak.", by Juha on July 13 2015.
Edited by Werner Pamler