Einzelnen Beitrag anzeigen

Andreas13

Registriert seit: 14. Okt 2006
Ort: Nürnberg
722 Beiträge
 
Delphi XE5 Professional
 
#5

AW: Anderes Verhalten in 12.3

  Alt 18. Apr 2025, 10:51
Hallo Edelfix,
damit beim Umsteigen von einer auf eine andere Delphi-Versionen sich soche Überraschungen in Grenzen halten, verwende ich zum eindeutigen Setzen meiner Format-Settings folgende Routine:
Delphi-Quellcode:
Procedure MyFormatSettings;
// Setzt DecimalSeparator etc. per Initialization
// Quelle:
// DecimalSeparator in SysUtils and System.SysUtils - Stack Overflow.pdf
// http://stackoverflow.com/questions/25109497/decimalseparator-in-sysutils-and-system-sysutils
// von Rodrigo Garcia

Var
  MyFormat: TFormatSettings; // --> TFormatSettings = record, daher KEIN MyFormat.Free!

Begin
  MyFormat:= TFormatSettings.Create;
    
  MyFormat.DecimalSeparator := '.'; // ',';
  MyFormat.ThousandSeparator:= ','; // '.';
  MyFormat.CurrencyDecimals := 2;
  MyFormat.DateSeparator := '/';
  MyFormat.ShortDateFormat := 'dd/mm/yyyy';
  MyFormat.LongDateFormat := 'dd/mm/yyyy';
  MyFormat.TimeSeparator := ':';
  MyFormat.TimeAMString := 'AM';
  MyFormat.TimePMString := 'PM';
  MyFormat.ShortTimeFormat := 'hh:nn';
  MyFormat.LongTimeFormat := 'hh:nn:ss';
  MyFormat.CurrencyString := 'R€'; // 'R$';

  System.SysUtils.FormatSettings:= MyFormat;
//
// TFormatSettings = record, daher KEIN MyFormat.Free!
End;{Procedure MyFormatSettings}
{------------------------------}
MyFormatSettings wird per Initialisierung in allen betroffenen eigenen Units eingebunden:
Delphi-Quellcode:
Unit Meine_Mathematische_Bibliothek; // etc.

Interface
...

Implementation

Uses
  System.SysUtils;
...

Initialization
  MyFormatSettings;
...
Finalization // ExitProcedures
...
End.
Vielleicht hilft es Dir.
Viel Erfolg!
Grüße, Andreas
Wenn man seinem Nächsten einen steilen Berg hinaufhilft, kommt man selbst dem Gipfel näher. (John C. Cornelius)
  Mit Zitat antworten Zitat