TDateEdit: avoid OnChange being issued in Loaded. Fixes issue described in https://forum.lazarus.freepascal.org/index.php/topic,60538.msg453740.html#msg453740

This commit is contained in:
Bart 2022-09-16 18:32:06 +02:00
parent 78b42debff
commit e7e585f13d

View File

@ -1714,11 +1714,15 @@ begin
end;
procedure TDateEdit.Loaded;
var
SavedOnChange: TNotifyEvent;
begin
inherited Loaded;
//Forces a valid Text in the control
if not (csDesigning in ComponentState) then
SetDate(FDate);
//avoid OnChange (regression introduced by #8ce29506c500e46d65b9a067bf446fd91224e6c0, happens when DirectInput=True and DefaultToday=True)
//the FEdit's OnChange is only forwarded once the whole component has been loaded, so call inherited after setting the text, not before
inherited Loaded;
end;
procedure TDateEdit.DoDateRangeCheck(var ADate: TDateTime);