mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 11:20:32 +02:00
LCL: Set position of Calendar- and CalculatorDialog to poScreenCenter at design time. Issue #22171
git-svn-id: trunk@37479 -
This commit is contained in:
parent
66f1e2dbff
commit
a2ad729243
@ -106,6 +106,21 @@ type
|
|||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TExtCommonDialog }
|
||||||
|
|
||||||
|
// A common base class for custom drawn dialogs (Calculator and Calendar).
|
||||||
|
TExtCommonDialog = class(TCommonDialog)
|
||||||
|
private
|
||||||
|
FDialogPosition: TPosition;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
published
|
||||||
|
property DialogPosition: TPosition read FDialogPosition write FDialogPosition default poMainFormCenter;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Calculator Dialog
|
Calculator Dialog
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
@ -120,7 +135,7 @@ type
|
|||||||
|
|
||||||
{ TCalculatorDialog }
|
{ TCalculatorDialog }
|
||||||
|
|
||||||
TCalculatorDialog = class(TCommonDialog)
|
TCalculatorDialog = class(TExtCommonDialog)
|
||||||
private
|
private
|
||||||
FLayout: TCalculatorLayout;
|
FLayout: TCalculatorLayout;
|
||||||
FValue: Double;
|
FValue: Double;
|
||||||
@ -128,7 +143,6 @@ type
|
|||||||
FTitle: String;
|
FTitle: String;
|
||||||
FPrecision: Byte;
|
FPrecision: Byte;
|
||||||
FBeepOnError: Boolean;
|
FBeepOnError: Boolean;
|
||||||
FHelpContext: THelpContext;
|
|
||||||
FCalc: TCalculatorForm;
|
FCalc: TCalculatorForm;
|
||||||
FOnChange: TNotifyEvent;
|
FOnChange: TNotifyEvent;
|
||||||
FOnCalcKey: TKeyPressEvent;
|
FOnCalcKey: TKeyPressEvent;
|
||||||
@ -148,7 +162,6 @@ type
|
|||||||
property Memory: Double read FMemory;
|
property Memory: Double read FMemory;
|
||||||
published
|
published
|
||||||
property BeepOnError: Boolean read FBeepOnError write FBeepOnError default True;
|
property BeepOnError: Boolean read FBeepOnError write FBeepOnError default True;
|
||||||
property HelpContext: THelpContext read FHelpContext write FHelpContext default 0;
|
|
||||||
property CalculatorLayout : TCalculatorLayout Read FLayout Write Flayout;
|
property CalculatorLayout : TCalculatorLayout Read FLayout Write Flayout;
|
||||||
property Precision: Byte read FPrecision write FPrecision default DefCalcPrecision;
|
property Precision: Byte read FPrecision write FPrecision default DefCalcPrecision;
|
||||||
property Title;
|
property Title;
|
||||||
@ -198,13 +211,11 @@ function CreateCalculatorForm(AOwner: TComponent; ALayout : TCalculatorLayout; A
|
|||||||
Type
|
Type
|
||||||
{ TCalendarDialog }
|
{ TCalendarDialog }
|
||||||
|
|
||||||
TCalendarDialog = class(TCommonDialog)
|
TCalendarDialog = class(TExtCommonDialog)
|
||||||
private
|
private
|
||||||
FDate: TDateTime;
|
FDate: TDateTime;
|
||||||
FDayChanged: TNotifyEvent;
|
FDayChanged: TNotifyEvent;
|
||||||
FDialogPosition: TPosition;
|
|
||||||
FDisplaySettings: TDisplaySettings;
|
FDisplaySettings: TDisplaySettings;
|
||||||
FHelpContext: THelpContext;
|
|
||||||
FMonthChanged: TNotifyEvent;
|
FMonthChanged: TNotifyEvent;
|
||||||
FYearChanged: TNotifyEvent;
|
FYearChanged: TNotifyEvent;
|
||||||
FOKCaption:TCaption;
|
FOKCaption:TCaption;
|
||||||
@ -222,10 +233,8 @@ Type
|
|||||||
property Date: TDateTime read FDate write FDate;
|
property Date: TDateTime read FDate write FDate;
|
||||||
property OnDayChanged: TNotifyEvent read FDayChanged write FDayChanged;
|
property OnDayChanged: TNotifyEvent read FDayChanged write FDayChanged;
|
||||||
property DisplaySettings: TDisplaySettings read FDisplaySettings write FDisplaySettings default DefaultDisplaySettings;
|
property DisplaySettings: TDisplaySettings read FDisplaySettings write FDisplaySettings default DefaultDisplaySettings;
|
||||||
property HelpContext: THelpContext read FHelpContext write FHelpContext default 0;
|
|
||||||
property OnMonthChanged: TNotifyEvent read FMonthChanged write FMonthChanged;
|
property OnMonthChanged: TNotifyEvent read FMonthChanged write FMonthChanged;
|
||||||
property OnYearChanged: TNotifyEvent read FYearChanged write FYearChanged;
|
property OnYearChanged: TNotifyEvent read FYearChanged write FYearChanged;
|
||||||
property DialogPosition: TPosition read FDialogPosition write FDialogPosition default poMainFormCenter;
|
|
||||||
property OKCaption:TCaption read FOKCaption write FOKCaption;
|
property OKCaption:TCaption read FOKCaption write FOKCaption;
|
||||||
property CancelCaption:TCaption read FCancelCaption write FCancelCaption;
|
property CancelCaption:TCaption read FCancelCaption write FCancelCaption;
|
||||||
end;
|
end;
|
||||||
@ -505,11 +514,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TExtCommonDialog }
|
||||||
|
|
||||||
|
constructor TExtCommonDialog.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FDialogPosition := poMainFormCenter; // Set the initial location on screen.
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TExtCommonDialog.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Calculator Dialog
|
Calculator Dialog
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
|
|
||||||
{ TCalcButton }
|
{ TCalcButton }
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -1057,6 +1080,10 @@ var
|
|||||||
begin
|
begin
|
||||||
FCalc:=CreateCalculatorForm(Application, FLayout, HelpContext);
|
FCalc:=CreateCalculatorForm(Application, FLayout, HelpContext);
|
||||||
try
|
try
|
||||||
|
if (csDesigning in ComponentState) then
|
||||||
|
FCalc.Position:=poScreenCenter
|
||||||
|
else
|
||||||
|
FCalc.Position:=DialogPosition;
|
||||||
CPanel:=TCalculatorPanel(FCalc.FCalcPanel);
|
CPanel:=TCalculatorPanel(FCalc.FCalcPanel);
|
||||||
FCalc.Caption:=Title;
|
FCalc.Caption:=Title;
|
||||||
CPanel.FMemory:=FMemory;
|
CPanel.FMemory:=FMemory;
|
||||||
@ -1225,7 +1252,6 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
DisplaySettings := DefaultDisplaySettings;
|
DisplaySettings := DefaultDisplaySettings;
|
||||||
Date := trunc(Now);
|
Date := trunc(Now);
|
||||||
DialogPosition := poMainFormCenter;
|
|
||||||
OKCaption := rsMbOK;
|
OKCaption := rsMbOK;
|
||||||
CancelCaption := rsMbCancel;
|
CancelCaption := rsMbCancel;
|
||||||
end;
|
end;
|
||||||
@ -1272,7 +1298,10 @@ begin
|
|||||||
DF:=TForm.CreateNew(Application, 0);
|
DF:=TForm.CreateNew(Application, 0);
|
||||||
DF.DisableAlign;
|
DF.DisableAlign;
|
||||||
DF.Caption:=Title;
|
DF.Caption:=Title;
|
||||||
DF.Position:=DialogPosition;
|
if (csDesigning in ComponentState) then
|
||||||
|
DF.Position:=poScreenCenter
|
||||||
|
else
|
||||||
|
DF.Position:=DialogPosition;
|
||||||
DF.BorderStyle:=bsDialog;
|
DF.BorderStyle:=bsDialog;
|
||||||
DF.AutoScroll:=false;
|
DF.AutoScroll:=false;
|
||||||
DF.AutoSize:=true;
|
DF.AutoSize:=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user