Posts

Showing posts with the label TFormatSettings

Formatsettings or TFormatSettings in Delphi

FormatSettings Formatsettings is a global variable of TFormatsettings record type in Delphi which is used to get local information's like DateTimeFormat, CurrencyFormat, DecimalSeparator etc. This variable was introduced in Delphi XE and before Delphi XE DateTimeFormat, DecimalSeparator, CurrencyFormat, etc. were declared as separate global variables in SysUtils.pas.   So when we migrate a Delphi project from old Delphi version to new Delphi version we generally get following errors and to solve this issue we need to use Formatsettings.DecimalSeparator.   Please visit my blog for more detail about such errors E2003 Undeclared identifier 'ShortDateFormat' error in Delphi XE3 or later versions Errors when we migrate a project from Delphi 7 to Delphi XE3 Undeclared identifier DecimalSeparator Undeclared identifier CurrencyFormat Undeclared identifier ThousandSeparator Undeclared identifier  DateSeparator Undeclared identifier ...

E2003 Undeclared identifier 'ShortDateFormat' error in Delphi XE3 or later versions

E2003 Undeclared identifier 'ShortDateFormat' error in Delphi XE3  or later versions When we upgrade a Delphi old version application to Delphi XE3 or latest one then if we have used ' ShortDateFormat ' global variable in our project then we will get 'E2003 Undeclared identifier 'ShortDateFormat' compiler error. Why we get this error? As some global variables typically pertain to Date, Time and Currency format ( CurrencyString , ShorDateFormat, LongTimeFormat, ShortMonthNames, and so on) have been deprecated and removed declaration from Delphi XE3 or later versions. In old Delphi versions we can find this variables declaration in 'System.SysUtils' unit but from Delphi XE3 those are moved with TFormatSettings Record. Workarounds to solve this error. We can replace ' ShortDateFormat ' with 'Formatsettings.ShortDateFormat'. And ' FormatSettings ' is a global variable of 'TFormatSettings' type declared in ...