View Issue Details

IDProjectCategoryView StatusLast Update
0005385JEDI VCL00 JVCL Componentspublic2012-06-11 17:09
ReportercorwinAssigned Toobones 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version 
Summary0005385: TJvValidateEdit has a bug in DecimalSeparator handling.
DescriptionDuring 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.
TagsNo tags attached.

Relationships

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

Activities

jfudickar

2010-10-31 21:44

developer   ~0017982

Could you create a small sample.

The Default value of aDecimalSeparator is ' ' and this will be translated/replaced at runtime by the current value.

corwin

2010-11-01 03:14

reporter   ~0017984

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.

corwin

2010-11-01 03:15

reporter   ~0017985

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

obones

2010-11-09 14:18

administrator   ~0018035

Please provide the zipped sources of a sample application showing this.

2010-11-11 11:17

 

1.zip (1,219 bytes)

corwin

2010-11-11 11:18

reporter   ~0018092

I've attached demo source.

jfudickar

2010-11-18 00:40

developer   ~0018127

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

obones

2011-06-07 17:30

administrator   ~0018574

Weird, weird, weird.
And what does the SVN Blame command tells us here? Does it give a valid log associated to that line?

obones

2012-02-24 11:57

administrator   ~0019529

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