View Issue Details

IDProjectCategoryView StatusLast Update
0006114JEDI VCL00 JVCL Componentspublic2014-12-04 16:28
ReportercguserAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionsuspended 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0006114: TJvValidateEdit: Issues with DisplayFormat of dfFloat
DescriptionChanging FormatSettings.DecimalSeparator makes the value bigger by 1000 factor.

{code}
  TJvValidateEdit *ed = new TJvValidateEdit(this);
  ed->Parent = this;
  ed->DisplayFormat = dfFloat;
  ed->DecimalPlaces = 3;

  // TJvValidateEdit was created when
  // FormatSettings.DecimalSeparator was still == '.'
  // However, if some component (like eg. MultiLizer) changes this
  // after (eg: form?) creation into FormatSettings.DecimalSeparator = ','
  // values are now multiplied by 1000.
  // Example:

  FormatSettings.DecimalSeparator = ',';
  ed->AsFloat = 1;
  if (ed->AsFloat == 1000)
    ShowMessage("Error!"); // it is now off by a factor of 1000
{code}

Related to case 0005579. Sorry for not reporting before, but only now while testing XE3, the issue came back (without previous manual fix of 0005579).
Additional InformationSetting the third parameter of all calls on JvValidateEdit.pas to JvSafeStrToFloatDef as

{$IFDEF RTL220_UP}FormatSettings.{$ENDIF RTL220_UP}DecimalSeparator

does solve this.
TagsNo tags attached.

Relationships

related to 0006178 closed Can't delete "0" char on TJvValidateEdit 

Activities

cguser

2013-04-02 18:47

reporter   ~0020458

Btw, tested with the latest svn version (13502):
http://jvcl.svn.sourceforge.net/viewvc/jvcl/trunk/jvcl/run/JvValidateEdit.pas?revision=13502

cguser

2013-04-03 11:26

reporter   ~0020459

The provided code sample on the Description has been solved on 0004682 (seemed familiar alright), through RecalcCheckChars.

However, the current issue does not *require* a change of FormatSettings.DecimalSeparator *after* component creation, eg:

{code}
  assert(FormatSettings.DecimalSeparator == '.'); // pass
  assert(GetLocaleChar(LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL,
    FormatSettings.DecimalSeparator) == '.'); // pass
  assert(GetLocaleChar(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL,
    FormatSettings.DecimalSeparator) == '.'); // pass

  // Let's say Multilizer changes DecimalSeparator into ',':
  FormatSettings.DecimalSeparator = ',';

  TJvValidateEdit *ed = new TJvValidateEdit(this);
  ed->Parent = this;
  ed->DisplayFormat = dfFloat;
  ed->DecimalPlaces = 3;
  ed->AsFloat = 1;
  assert(ed->AsFloat == 1.0); // fails, because now ed->AsFloat == 1000
{code}

cguser

2013-04-03 12:15

reporter   ~0020460

Just noticed that

{$IFDEF RTL220_UP}FormatSettings.{$ENDIF RTL220_UP}DecimalSeparator

has been deprecated around the code, being replaced instead with

JclFormatSettings.DecimalSeparator

Therefore, setting the *third* parameter of all calls on JvValidateEdit.pas to JvSafeStrToFloatDef as
 
JclFormatSettings.DecimalSeparator
 
does solve this once and for all (hopefully).

obones

2013-12-13 10:50

administrator   ~0020720

Please try with the latest JVCL version in GIT (or daily zip) and then send us a zipped file containing the sources of an application showing the issue.

obones

2014-12-04 16:28

administrator   ~0021102

No news, suspending the issue

Issue History

Date Modified Username Field Change
2013-04-02 18:45 cguser New Issue
2013-04-02 18:47 cguser Note Added: 0020458
2013-04-03 11:26 cguser Note Added: 0020459
2013-04-03 12:15 cguser Note Added: 0020460
2013-08-31 04:20 Arioch Relationship added related to 0006178
2013-12-13 10:50 obones Note Added: 0020720
2013-12-13 10:50 obones Status new => feedback
2014-12-04 16:28 obones Note Added: 0021102
2014-12-04 16:28 obones Status feedback => resolved
2014-12-04 16:28 obones Resolution open => suspended
2014-12-04 16:28 obones Assigned To => obones