TCalendar: nicer errormessage if a date is smaller than MinDateTime or larger than MaxDateTime.

This commit is contained in:
Bart 2022-07-19 10:37:43 +02:00
parent 44aa22799c
commit 6167bca327
26 changed files with 248 additions and 0 deletions

View File

@ -282,6 +282,12 @@ end;
procedure TCustomCalendar.CheckRange(ADate, AMinDate, AMaxDate: TDateTime); procedure TCustomCalendar.CheckRange(ADate, AMinDate, AMaxDate: TDateTime);
begin begin
//otherwise you get a message like "Invalid Date: 31-12-9999. Must be between 1-1-0001 and 31-12-9999"
if (ADate < Trunc(SysUtils.MinDateTime)) then
raise EInvalidDate.CreateFmt(rsDateTooSmall, [DateToStr(SysUtils.MinDateTime)]);
if (ADate > Trunc(SysUtils.MaxDateTime)) then
raise EInvalidDate.CreateFmt(rsDateTooLarge, [DateToStr(SysUtils.MaxDateTime)]);
if (ADate < AMinDate) or (ADate > AMaxDate) then if (ADate < AMinDate) or (ADate > AMaxDate) then
raise EInvalidDate.CreateFmt(rsInvalidDateRangeHint, [DateToStr(ADate), raise EInvalidDate.CreateFmt(rsInvalidDateRangeHint, [DateToStr(ADate),
DateToStr(AMinDate), DateToStr(AMaxDate)]); DateToStr(AMinDate), DateToStr(AMaxDate)]);

View File

@ -221,6 +221,16 @@ msgstr ""
msgid "Custom ..." msgid "Custom ..."
msgstr "" msgstr ""
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "" msgstr ""

View File

@ -217,6 +217,16 @@ msgstr "Schedarii di cursore"
msgid "Custom ..." msgid "Custom ..."
msgstr "Persunalizatu…" msgstr "Persunalizatu…"
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Predefinitu" msgstr "Predefinitu"

View File

@ -220,6 +220,16 @@ msgstr "Ukazatel"
msgid "Custom ..." msgid "Custom ..."
msgstr "Vlastní..." msgstr "Vlastní..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Výchozí" msgstr "Výchozí"

View File

@ -219,6 +219,16 @@ msgstr "Zeiger"
msgid "Custom ..." msgid "Custom ..."
msgstr "Eigene ..." msgstr "Eigene ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Voreingestellt" msgstr "Voreingestellt"

View File

@ -218,6 +218,16 @@ msgstr "Cursor"
msgid "Custom ..." msgid "Custom ..."
msgstr "Personalizado ..." msgstr "Personalizado ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Predeterminado" msgstr "Predeterminado"

View File

@ -216,6 +216,16 @@ msgstr "Kursori"
msgid "Custom ..." msgid "Custom ..."
msgstr "Mukautetut ..." msgstr "Mukautetut ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Oletus" msgstr "Oletus"

View File

@ -218,6 +218,16 @@ msgstr "Curseur"
msgid "Custom ..." msgid "Custom ..."
msgstr "Personnalisé..." msgstr "Personnalisé..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Par défaut" msgstr "Par défaut"

View File

@ -220,6 +220,16 @@ msgstr "סמן"
msgid "Custom ..." msgid "Custom ..."
msgstr "מותאם אישית ..." msgstr "מותאם אישית ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "ברירת מחדל" msgstr "ברירת מחדל"

View File

@ -218,6 +218,16 @@ msgstr "Kurzor"
msgid "Custom ..." msgid "Custom ..."
msgstr "Egyéni ..." msgstr "Egyéni ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Alapértelmezett" msgstr "Alapértelmezett"

View File

@ -222,6 +222,16 @@ msgstr ""
msgid "Custom ..." msgid "Custom ..."
msgstr "" msgstr ""
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "" msgstr ""

View File

@ -220,6 +220,16 @@ msgstr "cursore"
msgid "Custom ..." msgid "Custom ..."
msgstr "Personalizzato ..." msgstr "Personalizzato ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Standard" msgstr "Standard"

View File

@ -218,6 +218,16 @@ msgstr "カーソルファイル"
msgid "Custom ..." msgid "Custom ..."
msgstr "カスタム色" msgstr "カスタム色"
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "デフォルト色" msgstr "デフォルト色"

View File

@ -220,6 +220,16 @@ msgstr "Žymeklis"
msgid "Custom ..." msgid "Custom ..."
msgstr "Naudotojo…" msgstr "Naudotojo…"
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Numatytasis" msgstr "Numatytasis"

View File

@ -223,6 +223,16 @@ msgstr "Cursor"
msgid "Custom ..." msgid "Custom ..."
msgstr "Aangepast ..." msgstr "Aangepast ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Standaard" msgstr "Standaard"

View File

@ -220,6 +220,16 @@ msgstr ""
msgid "Custom ..." msgid "Custom ..."
msgstr "" msgstr ""
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "" msgstr ""

View File

@ -219,6 +219,16 @@ msgstr "Kursor"
msgid "Custom ..." msgid "Custom ..."
msgstr "Inny..." msgstr "Inny..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Domyślny" msgstr "Domyślny"

View File

@ -207,6 +207,16 @@ msgstr ""
msgid "Custom ..." msgid "Custom ..."
msgstr "" msgstr ""
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "" msgstr ""

View File

@ -216,6 +216,16 @@ msgstr "Cursor"
msgid "Custom ..." msgid "Custom ..."
msgstr "Personalizado ..." msgstr "Personalizado ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Padrão" msgstr "Padrão"

View File

@ -218,6 +218,16 @@ msgstr "Cursor"
msgid "Custom ..." msgid "Custom ..."
msgstr "Personalizado ..." msgstr "Personalizado ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Padrão" msgstr "Padrão"

View File

@ -214,6 +214,16 @@ msgstr "Файлы курсоров"
msgid "Custom ..." msgid "Custom ..."
msgstr "Пользовательский ..." msgstr "Пользовательский ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "По умолчанию" msgstr "По умолчанию"

View File

@ -216,6 +216,16 @@ msgstr "Kurzorové súbory"
msgid "Custom ..." msgid "Custom ..."
msgstr "Vlastná ..." msgstr "Vlastná ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Predvolené" msgstr "Predvolené"

View File

@ -218,6 +218,16 @@ msgstr "İmleç"
msgid "Custom ..." msgid "Custom ..."
msgstr "Özel ..." msgstr "Özel ..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "Varsayılan" msgstr "Varsayılan"

View File

@ -221,6 +221,16 @@ msgstr "Курсор"
msgid "Custom ..." msgid "Custom ..."
msgstr "Власний..." msgstr "Власний..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "За замовчуванням" msgstr "За замовчуванням"

View File

@ -219,6 +219,16 @@ msgstr "光标"
msgid "Custom ..." msgid "Custom ..."
msgstr "自定义..." msgstr "自定义..."
#: lclstrconsts.rsdatetoolarge
#, object-pascal-format
msgid "Date cannot be past %s"
msgstr ""
#: lclstrconsts.rsdatetoosmall
#, object-pascal-format
msgid "Date cannot be before %s"
msgstr ""
#: lclstrconsts.rsdefaultcolorcaption #: lclstrconsts.rsdefaultcolorcaption
msgid "Default" msgid "Default"
msgstr "默认" msgstr "默认"

View File

@ -238,6 +238,8 @@ resourceString
rsScrollBarOutOfRange = 'ScrollBar property out of range'; rsScrollBarOutOfRange = 'ScrollBar property out of range';
rsInvalidDate = 'Invalid Date : %s'; rsInvalidDate = 'Invalid Date : %s';
rsInvalidDateRangeHint = 'Invalid Date: %s. Must be between %s and %s'; rsInvalidDateRangeHint = 'Invalid Date: %s. Must be between %s and %s';
rsDateTooLarge = 'Date cannot be past %s';
rsDateTooSmall = 'Date cannot be before %s';
rsErrorOccurredInAtAddressFrame = 'Error occurred in %s at %sAddress %s%s' rsErrorOccurredInAtAddressFrame = 'Error occurred in %s at %sAddress %s%s'
+' Frame %s'; +' Frame %s';
rsException = 'Exception'; rsException = 'Exception';