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
0005385 [JEDI VCL] 00 JVCL Components major always 2010-10-29 11:34 2012-06-11 17:09
Reporter corwin View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version Daily / GIT
Summary 0005385: TJvValidateEdit has a bug in DecimalSeparator handling.
Description During handling float values TJvValidateEdit uses JvSafeStrToFloatDef
without setting aDecimalSeparator parameter.
So if programs change DesimalSeparator value at runtime,
then TJvValidateEdit sets incorrect values as number without desimalseparator in it.
For example: you enter 33.33 it saves 3333.

It can be solved to call JvSafeStrToFloatDef with setting aDesimalSeparator
parameter as DesimalSeparator.
Additional Information
Tags No tags attached.
Attached Files zip file icon 1.zip [^] (1,219 bytes) 2010-11-11 11:17

- Relationships
related to 0005579resolvedobones TJvValidateEdit: Issues with DisplayFormat of dfFloat with DecimalPlaces on x64 PT 
related to 0005060resolvedobones Wrong Display and Return of Float Values by TJvValidateEdit 

-  Notes
(0017982)
jfudickar (developer)
2010-10-31 21:44

Could you create a small sample.

The Default value of aDecimalSeparator is ' ' and this will be translated/replaced at runtime by the current value.
(0017984)
corwin (reporter)
2010-11-01 03:14

Step to reproduce
create VCL form project
put TJvValidateEdit and TButtont on it
make button click handler
---------
unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, JvExStdCtrls, JvEdit, JvValidateEdit;

type
  TForm2 = class(TForm)
    JvValidateEdit1: TJvValidateEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
  public
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
  JvValidateEdit1.Text := '12.34';
  showmessage(JvValidateEdit1.Value); // here shows 1234 !
end;

initialization
// assume that native decimalseparator = '.'
   DecimalSeparator := ',';

end.
(0017985)
corwin (reporter)
2010-11-01 03:15

And here dfm source
---
object Form2: TForm2
  Left = 0
  Top = 0
  Caption = 'Form2'
  ClientHeight = 282
  ClientWidth = 426
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object JvValidateEdit1: TJvValidateEdit
    Left = 74
    Top = 62
    Width = 121
    Height = 21
    CriticalPoints.MaxValueIncluded = False
    CriticalPoints.MinValueIncluded = False
    DisplayFormat = dfFloat
    DecimalPlaces = 2
    TabOrder = 0
  end
  object Button1: TButton
    Left = 201
    Top = 60
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 1
    OnClick = Button1Click
  end
end
(0018035)
obones (administrator)
2010-11-09 14:18

Please provide the zipped sources of a sample application showing this.
(0018092)
corwin (reporter)
2010-11-11 11:18

I've attached demo source.
(0018127)
jfudickar (developer)
2010-11-18 00:40

Hi Olivier,

the problem is that the _JvSafeStrToFloat function is not using global FormatSettings.DecimalSeparator.

This is the code and comment I do not understand:
  { Locale Handling logic October 2008 supercedes former StrToFloatUS functionality. }
  {$IFDEF RTL150_UP}
  LocalFormatSettings.ThousandSeparator := GetLocaleChar(LOCALE_SYSTEM_DEFAULT, LOCALE_STHOUSAND, '.');
  LocalFormatSettings.DecimalSeparator := GetLocaleChar(LOCALE_SYSTEM_DEFAULT, LOCALE_SDECIMAL, '.');
  {$ELSE}
  LocalFormatSettings.DecimalSeparator := DecimalSeparator;
  {$ENDIF RTL150_UP}


Kind regards
Jens
(0018574)
obones (administrator)
2011-06-07 17:30

Weird, weird, weird.
And what does the SVN Blame command tells us here? Does it give a valid log associated to that line?
(0019529)
obones (administrator)
2012-02-24 11:57

Please use the latest SVN content, I believe this is fixed by the commit for issue 0005060

- Issue History
Date Modified Username Field Change
2010-10-29 11:34 corwin New Issue
2010-10-31 21:44 jfudickar Note Added: 0017982
2010-10-31 21:44 jfudickar Status new => feedback
2010-11-01 03:14 corwin Note Added: 0017984
2010-11-01 03:15 corwin Note Added: 0017985
2010-11-09 14:18 obones Note Added: 0018035
2010-11-11 11:17 corwin File Added: 1.zip
2010-11-11 11:18 corwin Note Added: 0018092
2010-11-18 00:40 jfudickar Note Added: 0018127
2011-06-07 17:30 obones Note Added: 0018574
2011-06-07 18:00 obones Relationship added related to 0005579
2011-06-07 18:01 obones Relationship added related to 0005060
2012-02-24 11:57 obones Note Added: 0019529
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


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