mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 08:59:13 +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 SetDirectInput(AValue: Boolean); override;
|
||||||
procedure RealSetText(const AValue: TCaption); override;
|
procedure RealSetText(const AValue: TCaption); override;
|
||||||
procedure SetDateMask; virtual;
|
procedure SetDateMask; virtual;
|
||||||
|
procedure Loaded; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
function GetDateFormat: string;
|
function GetDateFormat: string;
|
||||||
@ -1653,9 +1654,11 @@ var
|
|||||||
Def: TDateTime;
|
Def: TDateTime;
|
||||||
begin
|
begin
|
||||||
inherited SetDirectInput(AValue);
|
inherited SetDirectInput(AValue);
|
||||||
//Synchronize FDate and force valid text
|
//Synchronize FDate
|
||||||
FDate := TextToDate(Text, NullDate);
|
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;
|
end;
|
||||||
|
|
||||||
procedure TDateEdit.RealSetText(const AValue: TCaption);
|
procedure TDateEdit.RealSetText(const AValue: TCaption);
|
||||||
@ -1709,6 +1712,14 @@ begin
|
|||||||
SetDate(D);
|
SetDate(D);
|
||||||
end;
|
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;
|
Function ParseDate(S : String; Order : TDateOrder; Def: TDateTime) : TDateTime;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
|
Loading…
Reference in New Issue
Block a user