Forum > Options
decimal separator
franzala:
With Lazarus 2.0.10 under Ubuntu 20.04 and french as language
(/etc/default/locale file shows LANG="fr_FR.UTF-8")
I obtain a dot as decimal separator with the numerical keypad.
How could I change it to a comma, which I obtain with other softwares as Libre Office Spreadsheets for instance.
AlexTP:
Assign to FormatSettings.DecimalSeparator ?
https://stackoverflow.com/questions/25109497/decimalseparator-in-sysutils-and-system-sysutils
Handoko:
Drop a TEdit on the form and put this code on the TEdit's OnChange event:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Edit1Change(Sender: TObject);var D: Double;begin DecimalSeparator := ','; if not(TryStrToFloat(Edit1.Text, D)) then Caption := '(error)' else Caption := D.ToString;end;
Read more:
https://www.freepascal.org/docs-html/rtl/sysutils/strtofloat.html
https://wiki.lazarus.freepascal.org/DecimalSeparator
https://www.freepascal.org/docs-html/rtl/sysutils/tformatsettings.html
Thaddy:
--- Quote from: AlexTP on May 23, 2022, 07:05:08 pm ---Assign to FormatSettings.DecimalSeparator ?
https://stackoverflow.com/questions/25109497/decimalseparator-in-sysutils-and-system-sysutils
--- End quote ---
No, make a copy of FormatSettings (an instance of a record) as a local instance of TFormatSettings (A record declaration) and change it there.
Sieben:
Try adding unit cLocale to the uses clause of your .lpr file, after(!) cThreads:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program MyProg; {$mode objfpc}{$H+} uses {$IFDEF UNIX} cThreads, cLocale, {$ENDIF} Interfaces, Forms, //...
Navigation
[0] Message Index
[#] Next page