The Delphi Bug List

Entry No.
653
VCL - General - Forms - TCustomForm
If the BorderStyle property is set to bsSizeToolWin, the AutoScroll property is read incorrectly. It will always be True when you run the program.
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
N/AAbsentAbsentAbsentAbsentExistsExistsExistsExistsExistsExistsExistsExistsExistsN/A
Description
Reported by Jordan Russell
If the BorderStyle property is set to bsSizeToolWin, the AutoScroll property is read incorrectly. It will always be True when you run the program.

This happens because in Delphi 4 and higher, the BorderStyle property is loaded after the AutoScroll property. The SetBorderStyle method changes AutoScroll to True if BorderStyle is bsSizeable or bsSizeToolWin.

Solution / workaround
I believe SetBorderStyle (in Forms.pas) should have been coded as follows (bold = new line). This way it doesn't try to change AutoScroll while the component is loading.
procedure TCustomForm.SetBorderStyle(Value: TFormBorderStyle);
begin
  if FBorderStyle <> Value then
  begin
    FBorderStyle := Value;
    if not (csLoading in ComponentState) then
      AutoScroll := FBorderStyle in [bsSizeable, bsSizeToolWin];
    if not (csDesigning in ComponentState) then RecreateWnd;
  end;
end;

If you don't want to modify the VCL source code, a workaround is to put an "AutoScroll := False" line in the form's OnCreate handler.

Latest update of this entry: 2002-02-20

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.