mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:49:30 +02:00
lcl: make AutoScroll delphi compatible:
- set AutoScroll to False by default for TForm and TFrame. Leave it True for TScrollBox - allow AutoScroll change for forms with bsSizeable, bsSizeToolWin BorderStyle git-svn-id: trunk@21478 -
This commit is contained in:
parent
b52f66dabc
commit
56c45690de
16
lcl/forms.pp
16
lcl/forms.pp
@ -159,7 +159,7 @@ type
|
||||
function StoreScrollBars : Boolean;
|
||||
protected
|
||||
class procedure WSRegisterClass; override;
|
||||
property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default true;
|
||||
property AutoScroll: Boolean read FAutoScroll write SetAutoScroll default False;
|
||||
procedure AlignControls(AControl: TControl; var ARect: TRect); override;
|
||||
procedure CreateWnd; override;
|
||||
function GetClientScrollOffset: TPoint; override;
|
||||
@ -197,7 +197,7 @@ type
|
||||
property Align;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property AutoScroll;
|
||||
property AutoScroll default True;
|
||||
property BorderSpacing;
|
||||
property BiDiMode;
|
||||
property BorderStyle default bsSingle;
|
||||
@ -428,13 +428,12 @@ type
|
||||
function GetPixelsPerInch: Longint;
|
||||
function GetRestoredLeft: integer;
|
||||
function GetRestoredTop: integer;
|
||||
function IsAutoScrollStored: Boolean;
|
||||
function IsForm: Boolean;
|
||||
function IsHelpFileStored: Boolean;
|
||||
function IsIconStored: Boolean;
|
||||
procedure CloseModal;
|
||||
procedure FreeIconHandles;
|
||||
procedure IconChanged(Sender: TObject);
|
||||
function IsKeyPreviewStored: Boolean;
|
||||
procedure SetActive(AValue: Boolean);
|
||||
procedure SetActiveControl(AWinControl: TWinControl);
|
||||
procedure SetActiveDefaultControl(AControl: TControl);
|
||||
@ -574,6 +573,7 @@ type
|
||||
property ActiveControl: TWinControl read FActiveControl write SetActiveControl;
|
||||
property ActiveDefaultControl: TControl read FActiveDefaultControl write SetActiveDefaultControl;
|
||||
property AllowDropFiles: Boolean read FAllowDropFiles write SetAllowDropFiles default False;
|
||||
property AutoScroll stored IsAutoScrollStored;
|
||||
property BorderIcons: TBorderIcons read FBorderIcons write SetBorderIcons
|
||||
default [biSystemMenu, biMinimize, biMaximize];
|
||||
property BorderStyle: TFormBorderStyle
|
||||
@ -588,11 +588,9 @@ type
|
||||
property FormState: TFormState read FFormState;
|
||||
property FormStyle: TFormStyle read FFormStyle write SetFormStyle
|
||||
default fsNormal;
|
||||
property HelpFile: string read FHelpFile write FHelpFile
|
||||
stored IsHelpFileStored;
|
||||
property HelpFile: string read FHelpFile write FHelpFile;
|
||||
property Icon: TIcon read FIcon write SetIcon stored IsIconStored;
|
||||
property KeyPreview: Boolean read FKeyPreview write FKeyPreview
|
||||
stored IsKeyPreviewStored default False;
|
||||
property KeyPreview: Boolean read FKeyPreview write FKeyPreview default False;
|
||||
property Menu : TMainMenu read FMenu write SetMenu;
|
||||
property ModalResult : TModalResult read FModalResult write SetModalResult;
|
||||
property Monitor: TMonitor read GetMonitor;
|
||||
@ -610,7 +608,7 @@ type
|
||||
property OnShortcut: TShortcutEvent read FOnShortcut write FOnShortcut;
|
||||
property OnShow: TNotifyEvent read FOnShow write FOnShow;
|
||||
property OnWindowStateChange: TNotifyEvent
|
||||
read fOnWindowStateChange write fOnWindowStateChange;
|
||||
read FOnWindowStateChange write FOnWindowStateChange;
|
||||
property ParentFont default False;
|
||||
property PixelsPerInch: Longint read GetPixelsPerInch write FPixelsPerInch stored False;
|
||||
property Position: TPosition read FPosition write SetPosition default poDesigned;
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
{ $DEFINE CHECK_POSITION}
|
||||
|
||||
const
|
||||
FormStylesAllowAutoScroll = [bsSizeable, bsSizeToolWin];
|
||||
|
||||
{ TCustomForm }
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -186,14 +189,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TCustomForm.IsKeyPreviewStored: boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomForm.IsKeyPreviewStored: boolean;
|
||||
begin
|
||||
Result:=FKeyPreview=true;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.SetCancelControl(NewControl: TControl);
|
||||
var
|
||||
OldCancelControl: TControl;
|
||||
@ -260,15 +255,6 @@ begin
|
||||
FModalResult:=AValue;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomForm.IsIconStored
|
||||
Returns: if form icon should be stored in the stream
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomForm.IsIconStored: Boolean;
|
||||
begin
|
||||
Result := IsForm and (Icon <> nil);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomForm.BigIconHandle
|
||||
Returns: HICON
|
||||
@ -1326,15 +1312,20 @@ var
|
||||
begin
|
||||
if FFormBorderStyle = NewStyle then exit;
|
||||
//TODO: Finish SETBORDERSTYLE
|
||||
|
||||
// AutoScroll is only available for bsSizeable, bsSizeToolWin windows
|
||||
if not (NewStyle in FormStylesAllowAutoScroll) then
|
||||
AutoScroll := False;
|
||||
|
||||
AdaptBorderIcons := not (csLoading in ComponentState) and
|
||||
(BorderIcons=DefaultBorderIcons[FFormBorderStyle]);
|
||||
(BorderIcons = DefaultBorderIcons[FFormBorderStyle]);
|
||||
FFormBorderStyle := NewStyle;
|
||||
|
||||
// if Form had default border icons before change, it should keep the default
|
||||
if AdaptBorderIcons then
|
||||
BorderIcons := DefaultBorderIcons[FFormBorderStyle];
|
||||
|
||||
Include(FFormState,fsBorderStyleChanged);
|
||||
Include(FFormState, fsBorderStyleChanged);
|
||||
// ToDo: implement it.
|
||||
// We can not use inherited SetBorderStyle(NewStyle),
|
||||
// because TBorderStyle <> TFormBorderStyle;
|
||||
@ -1714,14 +1705,34 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TCustomForm Method IsForm
|
||||
------------------------------------------------------------------------------}
|
||||
{------------------------------------------------------------------------------}
|
||||
{ Method: TCustomForm.IsAutoScrollStored }
|
||||
{ Returns: if form AutoScroll should be stored in the stream }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TCustomForm.IsAutoScrollStored: Boolean;
|
||||
begin
|
||||
// store autoscroll only if BorderStyle allows this
|
||||
Result := IsForm and (BorderStyle in FormStylesAllowAutoScroll);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ Method: TCustomForm.IsForm }
|
||||
{ Returns: if form properties should be stored in the stream }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TCustomForm.IsForm: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ Method: TCustomForm.IsIconStored }
|
||||
{ Returns: if form icon should be stored in the stream }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TCustomForm.IsIconStored: Boolean;
|
||||
begin
|
||||
Result := IsForm and (Icon <> nil);
|
||||
end;
|
||||
|
||||
function TCustomForm.GetPixelsPerInch: Longint;
|
||||
var
|
||||
ParentForm: TCustomForm;
|
||||
@ -1769,14 +1780,6 @@ begin
|
||||
Result := FRestoredTop;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TCustomForm.IsHelpFileStored: boolean;
|
||||
------------------------------------------------------------------------------}
|
||||
function TCustomForm.IsHelpFileStored: boolean;
|
||||
begin
|
||||
Result:=FHelpFile<>'';
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TCustomForm Method SetFocusedControl
|
||||
|
||||
|
@ -25,6 +25,7 @@ constructor TScrollBox.Create(AOwner: TComponent);
|
||||
begin
|
||||
Inherited Create(AOwner);
|
||||
fCompStyle:= csScrollBox;
|
||||
AutoScroll := True;
|
||||
BorderStyle := bsSingle;
|
||||
end;
|
||||
|
||||
|
@ -262,7 +262,7 @@ constructor TScrollingWinControl.Create(TheOwner : TComponent);
|
||||
begin
|
||||
Inherited Create(TheOwner);
|
||||
|
||||
FAutoScroll := true;
|
||||
FAutoScroll := False;
|
||||
FVertScrollbar := TControlScrollBar.Create(Self, sbVertical);
|
||||
FHorzScrollbar := TControlScrollBar.Create(Self, sbHorizontal);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user