View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005579 | JEDI VCL | 00 JVCL Components | public | 2011-05-11 13:51 | 2012-06-11 17:09 |
Reporter | cguser | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | ||||
Summary | 0005579: TJvValidateEdit: Issues with DisplayFormat of dfFloat with DecimalPlaces on x64 PT | ||||
Description | On a Win7 x64, with "Region and Language" set as: Format = Portuguese (implies DecimalSeparator = ','), TJvValidateEdit property GetAsFloat will be off by a factor of 1000. TJvValidateEdit *ed = new TJvValidateEdit(this); ed->Parent = this; ed->DisplayFormat = dfFloat; ed->DecimalPlaces = 3; ed->AsFloat = 1; if (ed->AsFloat==1000) ShowMessage("Error!"); | ||||
Additional Information | This seems to be rooted on a JvSafeStrToFloat call as shown below. JvSafeStrToFloat("1,000")==1; // true on Win7 x86 PT, false on Win7 x64 PT Using it's default extra parameter of aDecimalSepartor "solves" the problem: JvSafeStrToFloat("1,000",DecimalSeparator)==1; // true on both Win7 x86 and x64 PT Therefore, as a workaround for JvValidateEdit.pas, on function TJvCustomValidateEdit.GetAsFloat: Double; change Result := JvSafeStrToFloatDef(FEditText, 0); into Result := JvSafeStrToFloatDef(FEditText, 0, {$IFDEF RTL220_UP}FormatSettings.{$ENDIF RTL220_UP}DecimalSeparator); This fixed (hidded?) the issue. Just to add that this was tested on a daily SVN version from last January, sorry if it's been noticed/fixed meanwhile. | ||||
Tags | No tags attached. | ||||
|
More details, this was with RS2010 with all updates applied. |
|
Probably the root of all this (and maybe x64 is not the real culprit), On the Win7 x86, PT Format (system and user) GetLocaleChar(LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL, DecimalSeparator)) == GetLocaleChar(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, DecimalSeparator)) == ','; On the Win7 x64, PT Format (system!=user?) GetLocaleChar(LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL, DecimalSeparator)) == '.'; GetLocaleChar(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, DecimalSeparator)) == ','; It seems that in some cases, mismatching settings of LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT may trigger this. |
|
I would venture that the suggested fix is accurate (while somewhat incomplete). *All* calls from JvValidateEdit.pas into JvSafeStrToFloatDef should have the third parameter filled as {$IFDEF RTL220_UP}FormatSettings.{$ENDIF RTL220_UP}DecimalSeparator because *if* that argument isn't sent, _JvSafeStrToFloat will just default into using LOCALE_SYSTEM_DEFAULT. |
|
Last tidbit, on a W7 x86, changing the users Decimal symbol on Control Panel's Format, Additional Settings, it does change it for *both* LOCALE_SYSTEM_DEFAULT and LOCALE_USER_DEFAULT settings, while on x64, it will only affect the latter. |
|
We've just had in a new support issue for this very same problem on an Estonian WinXP customer. They also used "," as DecimalSeparator. This shows that the problem is not unique to Win7 x64 nor PT. |
|
There are other issues on that subject in Mantis |
|
Please use the latest SVN content, I believe this is fixed by the commit for issue 0005060 |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-05-11 13:51 | cguser | New Issue | |
2011-05-11 15:00 | cguser | Note Added: 0018550 | |
2011-05-11 16:27 | cguser | Note Added: 0018551 | |
2011-05-11 17:26 | cguser | Note Added: 0018552 | |
2011-05-12 13:10 | cguser | Note Added: 0018553 | |
2011-05-13 13:08 | cguser | Note Added: 0018554 | |
2011-06-07 18:00 | obones | Note Added: 0018636 | |
2011-06-07 18:00 | obones | Status | new => acknowledged |
2011-06-07 18:00 | obones | Relationship added | related to 0005385 |
2011-06-07 18:01 | obones | Relationship added | related to 0005060 |
2012-02-24 11:58 | obones | Note Added: 0019530 | |
2012-02-24 11:58 | obones | Status | acknowledged => feedback |
2012-06-11 17:09 | obones | Status | feedback => resolved |
2012-06-11 17:09 | obones | Resolution | open => fixed |
2012-06-11 17:09 | obones | Assigned To | => obones |