Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006114 [JEDI VCL] 00 JVCL Components major always 2013-04-02 18:45 2014-12-04 16:28
Reporter cguser View Status public  
Assigned To obones
Priority normal Resolution suspended  
Status resolved   Product Version Daily / GIT
Summary 0006114: TJvValidateEdit: Issues with DisplayFormat of dfFloat
Description Changing 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 Information Setting the third parameter of all calls on JvValidateEdit.pas to JvSafeStrToFloatDef as

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

does solve this.
Tags No tags attached.
Attached Files

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

-  Notes
(0020458)
cguser (reporter)
2013-04-02 18:47

Btw, tested with the latest svn version (13502):
http://jvcl.svn.sourceforge.net/viewvc/jvcl/trunk/jvcl/run/JvValidateEdit.pas?revision=13502 [^]
(0020459)
cguser (reporter)
2013-04-03 11:26

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}
(0020460)
cguser (reporter)
2013-04-03 12:15

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).
(0020720)
obones (administrator)
2013-12-13 10:50

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.
(0021102)
obones (administrator)
2014-12-04 16:28

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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker