lcl: better protect Form.AutoScroll from change when BorderStyle does not allow this

git-svn-id: trunk@21479 -
This commit is contained in:
paul 2009-08-29 03:50:50 +00:00
parent 56c45690de
commit 0dafbae6a4
2 changed files with 12 additions and 6 deletions

View File

@ -153,13 +153,11 @@ type
FVertScrollBar: TControlScrollBar;
FAutoScroll: Boolean;
FIsUpdating: Boolean;
procedure SetAutoScroll(Value: Boolean);
procedure SetHorzScrollBar(Value: TControlScrollBar);
procedure SetVertScrollBar(Value: TControlScrollBar);
function StoreScrollBars : Boolean;
function StoreScrollBars: Boolean;
protected
class procedure WSRegisterClass; override;
property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default False;
procedure AlignControls(AControl: TControl; var ARect: TRect); override;
procedure CreateWnd; override;
function GetClientScrollOffset: TPoint; override;
@ -170,7 +168,9 @@ type
function ComputeScrollbars: Boolean; virtual;
procedure ScrollbarHandler(ScrollKind: TScrollBarKind;
OldPosition: Integer); virtual;
procedure SetAutoScroll(Value: Boolean); virtual;
procedure Loaded; override;
property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default False;
public
constructor Create(TheOwner : TComponent); override;
destructor Destroy; override;
@ -508,6 +508,7 @@ type
procedure DoSendBoundsToInterface; override;
procedure DoAutoSize; override;
procedure SetAutoSize(Value: Boolean); override;
procedure SetAutoScroll(Value: Boolean); override;
protected
// drag and dock
procedure BeginAutoDrag; override;

View File

@ -21,7 +21,7 @@
{ $DEFINE CHECK_POSITION}
const
FormStylesAllowAutoScroll = [bsSizeable, bsSizeToolWin];
BorderStylesAllowAutoScroll = [bsSizeable, bsSizeToolWin];
{ TCustomForm }
@ -1092,6 +1092,11 @@ begin
inherited SetAutoSize(Value);
end;
procedure TCustomForm.SetAutoScroll(Value: Boolean);
begin
inherited SetAutoScroll(Value and (BorderStyle in BorderStylesAllowAutoScroll));
end;
procedure TCustomForm.BeginAutoDrag;
begin
// allow form dragging only if it is docked into a site without DockManager
@ -1314,7 +1319,7 @@ begin
//TODO: Finish SETBORDERSTYLE
// AutoScroll is only available for bsSizeable, bsSizeToolWin windows
if not (NewStyle in FormStylesAllowAutoScroll) then
if not (NewStyle in BorderStylesAllowAutoScroll) then
AutoScroll := False;
AdaptBorderIcons := not (csLoading in ComponentState) and
@ -1712,7 +1717,7 @@ end;
function TCustomForm.IsAutoScrollStored: Boolean;
begin
// store autoscroll only if BorderStyle allows this
Result := IsForm and (BorderStyle in FormStylesAllowAutoScroll);
Result := IsForm and (BorderStyle in BorderStylesAllowAutoScroll);
end;
{------------------------------------------------------------------------------}