Implemented an OnChange event on a TsDateEdit, in order to set a CalendarDate for a TsMonthCalendar.
It is possible to exit the TsDateEdit with the TsDateEdit.Date property still set to 0.
In this project: [attachment=7743:acCalendarMouseUp.zip]
try to delete the 0 from the 06 month. You will see the TsMonthCalendar jump to 30 december 1899, because the TsDateEdit.Date is still at 0, although the date is valid. Even when you leave the TsDateEdit control, the date remains 0.
I think this is caused by some typical coding in the GetDate function:
Code:
function TsCustomDateEdit.GetDate: TDateTime;
begin
if (Pos(s_Space, Text) > 0) or (NullDate = FIntDate) then
if DefaultToday and not (csDesigning in ComponentState) then
Result := SysUtils.Date
else
Result := NullDate
else
Result := FIntDate;
end;
The test whether a space is in the date is not correct, a space in the date text may still yield a valid date.