From 6a64348cd5800386eefecae2235fdfd0224ab415 Mon Sep 17 00:00:00 2001 From: zoran Date: Sat, 22 Dec 2018 09:04:00 +0000 Subject: [PATCH] DateTimePicker: a small cleanup git-svn-id: trunk@59891 - --- components/datetimectrls/datetimepicker.pas | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/components/datetimectrls/datetimepicker.pas b/components/datetimectrls/datetimepicker.pas index 9a81593f60..27a0b502b4 100644 --- a/components/datetimectrls/datetimepicker.pas +++ b/components/datetimectrls/datetimepicker.pas @@ -728,14 +728,7 @@ begin if AndSetTheDate then begin Inc(DTPicker.FUserChanging); try - if DTPicker.DateIsNull then begin - // we'll set the time to 0.0 (midnight): - DTPicker.SetDateTime(Int(Cal.GetDate)); - end else if not EqualDateTime(Int(DTPicker.DateTime), - Int(Cal.GetDate)) then begin - // we'll change the date, but keep the time: - DTPicker.SetDateTime(ComposeDateTime(Cal.GetDate, DTPicker.DateTime)); - end; + DTPicker.SetDate(Cal.GetDate); DTPicker.DoAutoCheck; finally Dec(DTPicker.FUserChanging); @@ -935,12 +928,7 @@ begin if Assigned(DTPickersParentForm) then DTPickersParentForm.RemoveAllHandlersOfObject(Self); - if Assigned(Cal) then begin - Cal.GetCalendarControl.OnResize := nil; - Cal.GetCalendarControl.OnClick := nil; - Cal.Free; - Cal := nil; - end; + FreeAndNil(Cal); FreeAndNil(Shape); if Assigned(DTPicker) then begin