Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Additional Controls/TScrollBox    [ Add a report in this area ]  
Report #:  98555   Status: Open
ScrollBox & Anchors Bug, reproducable in Delphi 2009,2010,XE
Project:  Delphi Build #:  15.0.3890.34076
Version:    15.0 Submitted By:   Gavin Froude
Report Type:  Basic functionality failure Date Reported:  9/5/2011 7:18:22 AM
Severity:    Commonly encountered problem Last Updated: 4/4/2013 6:25:33 PM
Platform:    All platforms Internal Tracking #:   23460
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: 11
Added by Sysop
This issue is similar to QC#71557(Internal#270370).


There is a bug with the TScrollBox that has existed from at least delphi 2009, and still occurs in delphi 2010 & XE.

The bug involves resizing the contents of a TScrollbox using the anchors properties to have controls auto size to the scrollbox size.

If you have a scrollbox control with controls set to anchor to the right or align with client, and you have the scrollbox control set to anchor to the form size, then upon maximising the form window - if the scrollbox position is not at zero...the control contents don't resize, and when you restore the main form the controls shrink to almost zero width...after which point the whole anchors feature is broken and you have to restart your application.

The problem only occurs if the maximising of the window results in the scroll box vertical bar the range of the scrollbox was set such that it required scrolling when the window was normal size, and then when the window was maximised it didnt require scrolling and the vertical bar dissapears as expected....

It seems the trigger for the bug, is if a maximise of the form window is going to cause a scrollbox to resize so that it no longer needs to display a scrollbar...then if the scrollbox contains anchored controls and the scrollbars were not at position 0 - the controls do not resize, and then end up being shrunk beyond their original size when the scrollbox is resized back.
Steps to Reproduce:
-Create a blank vcl form window.
-Add a TScrollBox control, Set align property to 'alclient'
-Set VertScrollbar.range such that it has a vertical scrollbar when the window is normal size, but would loose it when the form window is maximised.
-Add some controls (such as a groupbox) to the scrollbox. Set the left, right and top anchors - making the controls size with the scrollbox window width.

Compile and run...scroll the scrollbox down beyond position 0...maximise the window.

The scrollbox controls should fail to size with the scrollbox upon maximising...upon restoring window size the controls will probably dissapear as their width has now been set below 0.
Don't use anchors...resize manually on resize events.

Tomohiro Takahashi at 9/5/2011 6:35:00 PM -
Could you please attach sample project to confirm your issue?

Gavin Froude at 9/6/2011 5:26:04 PM -
I have attached a small project file which contains a scroll box and group box. Compile and run...scroll the scroll box down a bit from its zero position and then maximise. The groupbox will not scale with the scroll box, even though its anchors are set. If you then restore the window, the groupbox will shrink or dissapear.

Tomohiro Takahashi at 9/6/2011 6:30:27 PM -
Thanks for the attachment.
So, is your issue same as(similar to) QC#71557 ?

Gavin Froude at 9/7/2011 2:14:44 AM -
It is similar. I have tested the issues referred to in report 71557, and my example also exhibits the same problem.

However the issue of it 'shrinking' on maximising the window is more severe as it doesn't just shrink the controls inside a scrollbox by a small amount, but by an amount so big that all the controls can dissappear with negative widths.

If the example i have attached is not showing the bug i am describing, then the screen resolution maybe too small for the vertical bar to dissapear when you maximise. If thats the case, reduce the scroll box vertical bar range to say 500.

It should be noted that the problem does not happen with delphi 7.

Gavin Froude at 10/11/2011 4:25:28 PM -
The problem still exists in Delphi XE2 (update 1)

Chris Nillissen at 4/4/2013 6:17:33 PM -
Problem still exists in XE3!!! Why the HELL are these bugs NOT GETTING FIXED!!!!!!!! There are numerous bugs with TScrollbox ones that have been around since Delphi 7!!! Getting really pissed with all these critical issues that are not getting fixed.

Tomohiro Takahashi at 4/4/2013 6:25:07 PM -
Thanks for the notification. I updated internal status of this report.

Chris Nillissen at 6/6/2013 7:36:01 PM -
Still exists in XE4!!

Gavin Froude at 9/3/2014 7:08:35 AM -
Still exists on XE6...and no doubt XE7

Ján Kolár at 5/27/2015 7:07:03 AM -
The problem still persists in XE4 Update1.

Server Response from: ETNACODE01