AW: Verständnisfrage zu TFormatSettings
Zitat:
|
AW: Verständnisfrage zu TFormatSettings
Zitat:
|
AW: Verständnisfrage zu TFormatSettings
Zitat:
Wie's scheint funktioniert es jetzt damit:
Delphi-Quellcode:
Dann auf zum nächsten Problem... ;-)
fs := TFormatSettings.Create('de-DE');
fs.DateSeparator := '.'; fs.TimeSeparator := ':'; fs.ShortDateFormat := 'dd/MM/yyyy'; fs.LongTimeFormat := 'hh:mm:ss'; |
AW: Verständnisfrage zu TFormatSettings
Ich habe ein ähnliches Problem. Ich habe vorher in Delphi 7 in meiner MainForm einfach im FormCreate : DecimalSeparator := '.'; gesetzt und das hat es dann für alle Units auch gemacht. Jetzt habe ich meine Software für Delphi 10.2 umgeschrieben und bekomme es nicht hin, dass StrToFloat geht. Ich gebe in meinem Beispiel Trunc(StrToFloat(edtXStart.Text) * 10); ein. Wobei gerade edtXStart.Text := '61.0' sind. Es sollte am Ende also 610 rauskommen. Ich bekomme aber immer "Exception class EConvertError with message ''61.0' is not a valid floating point value'". Wie kann ich am Einfachsten in Delphi 10.2 einmal für alle Units in meinem Projekt den DecimalSeparator festlegen? Die Vorschläge die hier genannt wurden habe ich in meiner MainForm (in FormCreate) probiert und es hat bei der Funktion die in einer anderen Form ist nichts geändert.
|
AW: Verständnisfrage zu TFormatSettings
Schon im FormCreate...
Delphi-Quellcode:
probiert und dann...
fs := TFormatSettings.Create;
fs.DecimalSeparator := '.';
Delphi-Quellcode:
?
StrToFloat(edtXStart.Text, fs)
Ist wahrscheinlich total falsch aber so klappt es bei mir. Oder eben im FormCreate
Delphi-Quellcode:
und dann
FormatSettings.DecimalSeparator := '.';
Delphi-Quellcode:
StrToFloat(edtXStart.Text)
|
AW: Verständnisfrage zu TFormatSettings
Ich habe jetzt einfach in der Unit wo ich StrToFloat brauche
initialization System.SysUtils.FormatSettings.DecimalSeparator := '.'; genutzt. |
AW: Verständnisfrage zu TFormatSettings
Zitat:
Delphi-Quellcode:
setzen. Ansonsten werden die Formatsettings überschrieben wenn die Anwendung eine WM_WININICHANGE oder RM_TaskbarCreated
Application.UpdateFormatSettings := false;
erhält. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:13 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz