r2kc
asked on
TFormatSettings.DecimalSeparator not working in Delphi XE7
Hi
I am trying to change the DecimalSeparator with the following code:
procedure TWealthForm.FormCreate(Sen der: TObject);
var
SystemDecimalSep: Char;
fs: TFormatSettings;
begin
fs := TFormatSettings.Create();
SystemDecimalSep := fs.DecimalSeparator;
fs.DecimalSeparator := '.';
end;
It does not seem to work though. The default on Windows is a comma and I want to change it to a decimal point. Can anyone please assist with this?
Many Thanks.
I am trying to change the DecimalSeparator with the following code:
procedure TWealthForm.FormCreate(Sen
var
SystemDecimalSep: Char;
fs: TFormatSettings;
begin
fs := TFormatSettings.Create();
SystemDecimalSep := fs.DecimalSeparator;
fs.DecimalSeparator := '.';
end;
It does not seem to work though. The default on Windows is a comma and I want to change it to a decimal point. Can anyone please assist with this?
Many Thanks.
ASKER
Hi Sinisa
Thanks for the response.
The above still does not work for the TdxDBGridColumn.
I need to change the decimal separator for editing purposes. I want the user to enter a decimal value into a column in the column.
Thanks.
Thanks for the response.
The above still does not work for the TdxDBGridColumn.
I need to change the decimal separator for editing purposes. I want the user to enter a decimal value into a column in the column.
Thanks.
Maybe you can check user enter on KeyPress event:
... this cod will allow only point as input character.
procedure ColumnKeyPress(Sender: TObject; var Key: Char);
begin
if not (Key in ['0'..'9', #8, '.'] then Key:=#0;
end;
... this cod will allow only point as input character.
ASKER
This bit of code is also not working. I suspect that there may be an issue with the third party component that I am using. It will not accept the decimal point as the decimal separator if the regional settings are set to something else. I will try another grid component.
Thanks for the responses.
Thanks for the responses.
yes, that could be solution too... or you can contact grid developer to help you (or make changes...)
ASKER
Thanks. I'll try that.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Open in new window
Why do you need to change decimal separator? For viewing or editing?
There are other solutions....