mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 04:39:36 +02:00
TDateEdit: Don't change empty Text when toggling DirectInput in designer. Part of Issue #0030425.
git-svn-id: trunk@54070 -
This commit is contained in:
parent
e5eb17948e
commit
8ce29506c5
@ -569,6 +569,7 @@ type
|
||||
procedure SetDirectInput(AValue: Boolean); override;
|
||||
procedure RealSetText(const AValue: TCaption); override;
|
||||
procedure SetDateMask; virtual;
|
||||
procedure Loaded; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function GetDateFormat: string;
|
||||
@ -1653,9 +1654,11 @@ var
|
||||
Def: TDateTime;
|
||||
begin
|
||||
inherited SetDirectInput(AValue);
|
||||
//Synchronize FDate and force valid text
|
||||
//Synchronize FDate
|
||||
FDate := TextToDate(Text, NullDate);
|
||||
SetDate(FDate);
|
||||
//Force a valid date in the control, but not if Text was empty in designmode
|
||||
if not ((csDesigning in ComponentState) and FDefaultToday and (FDate = NullDate)) then
|
||||
SetDate(FDate);
|
||||
end;
|
||||
|
||||
procedure TDateEdit.RealSetText(const AValue: TCaption);
|
||||
@ -1709,6 +1712,14 @@ begin
|
||||
SetDate(D);
|
||||
end;
|
||||
|
||||
procedure TDateEdit.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
//Forces a valid Text in the control
|
||||
if not (csDesigning in ComponentState) then
|
||||
SetDate(FDate);
|
||||
end;
|
||||
|
||||
Function ParseDate(S : String; Order : TDateOrder; Def: TDateTime) : TDateTime;
|
||||
|
||||
Var
|
||||
|
Loading…
Reference in New Issue
Block a user