View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005385 | JEDI VCL | 00 JVCL Components | public | 2010-10-29 11:34 | 2012-06-11 17:09 |
Reporter | corwin | Assigned To | obones | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | ||||
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. | ||||
Tags | No tags attached. | ||||
|
Could you create a small sample. The Default value of aDecimalSeparator is ' ' and this will be translated/replaced at runtime by the current value. |
|
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. |
|
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 |
|
Please provide the zipped sources of a sample application showing this. |
2010-11-11 11:17
|
1.zip (1,219 bytes) |
|
I've attached demo source. |
|
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 |
|
Weird, weird, weird. And what does the SVN Blame command tells us here? Does it give a valid log associated to that line? |
|
Please use the latest SVN content, I believe this is fixed by the commit for issue 0005060 |
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 |