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);
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
raise EInvalidDate.CreateFmt(rsInvalidDateRangeHint, [DateToStr(ADate),
DateToStr(AMinDate), DateToStr(AMaxDate)]);

View File

@ -221,6 +221,16 @@ msgstr ""
msgid "Custom ..."
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
msgid "Default"
msgstr ""

View File

@ -217,6 +217,16 @@ msgstr "Schedarii di cursore"
msgid "Custom ..."
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
msgid "Default"
msgstr "Predefinitu"

View File

@ -220,6 +220,16 @@ msgstr "Ukazatel"
msgid "Custom ..."
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
msgid "Default"
msgstr "Výchozí"

View File

@ -219,6 +219,16 @@ msgstr "Zeiger"
msgid "Custom ..."
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
msgid "Default"
msgstr "Voreingestellt"

View File

@ -218,6 +218,16 @@ msgstr "Cursor"
msgid "Custom ..."
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
msgid "Default"
msgstr "Predeterminado"

View File

@ -216,6 +216,16 @@ msgstr "Kursori"
msgid "Custom ..."
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
msgid "Default"
msgstr "Oletus"

View File

@ -218,6 +218,16 @@ msgstr "Curseur"
msgid "Custom ..."
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
msgid "Default"
msgstr "Par défaut"

View File

@ -220,6 +220,16 @@ msgstr "סמן"
msgid "Custom ..."
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
msgid "Default"
msgstr "ברירת מחדל"

View File

@ -218,6 +218,16 @@ msgstr "Kurzor"
msgid "Custom ..."
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
msgid "Default"
msgstr "Alapértelmezett"

View File

@ -222,6 +222,16 @@ msgstr ""
msgid "Custom ..."
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
msgid "Default"
msgstr ""

View File

@ -220,6 +220,16 @@ msgstr "cursore"
msgid "Custom ..."
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
msgid "Default"
msgstr "Standard"

View File

@ -218,6 +218,16 @@ msgstr "カーソルファイル"
msgid "Custom ..."
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
msgid "Default"
msgstr "デフォルト色"

View File

@ -220,6 +220,16 @@ msgstr "Žymeklis"
msgid "Custom ..."
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
msgid "Default"
msgstr "Numatytasis"

View File

@ -223,6 +223,16 @@ msgstr "Cursor"
msgid "Custom ..."
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
msgid "Default"
msgstr "Standaard"

View File

@ -220,6 +220,16 @@ msgstr ""
msgid "Custom ..."
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
msgid "Default"
msgstr ""

View File

@ -219,6 +219,16 @@ msgstr "Kursor"
msgid "Custom ..."
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
msgid "Default"
msgstr "Domyślny"

View File

@ -207,6 +207,16 @@ msgstr ""
msgid "Custom ..."
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
msgid "Default"
msgstr ""

View File

@ -216,6 +216,16 @@ msgstr "Cursor"
msgid "Custom ..."
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
msgid "Default"
msgstr "Padrão"

View File

@ -218,6 +218,16 @@ msgstr "Cursor"
msgid "Custom ..."
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
msgid "Default"
msgstr "Padrão"

View File

@ -214,6 +214,16 @@ msgstr "Файлы курсоров"
msgid "Custom ..."
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
msgid "Default"
msgstr "По умолчанию"

View File

@ -216,6 +216,16 @@ msgstr "Kurzorové súbory"
msgid "Custom ..."
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
msgid "Default"
msgstr "Predvolené"

View File

@ -218,6 +218,16 @@ msgstr "İmleç"
msgid "Custom ..."
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
msgid "Default"
msgstr "Varsayılan"

View File

@ -221,6 +221,16 @@ msgstr "Курсор"
msgid "Custom ..."
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
msgid "Default"
msgstr "За замовчуванням"

View File

@ -219,6 +219,16 @@ msgstr "光标"
msgid "Custom ..."
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
msgid "Default"
msgstr "默认"

View File

@ -238,6 +238,8 @@ resourceString
rsScrollBarOutOfRange = 'ScrollBar property out of range';
rsInvalidDate = 'Invalid Date : %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'
+' Frame %s';
rsException = 'Exception';