View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001597 | JEDI VCL | 00 JVCL Components | public | 2004-04-07 08:09 | 2004-04-07 14:43 |
Reporter | anonymous | Assigned To | user72 | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0001597: Bug in TJvValidateEdit in latest CVS | ||||
Description | DesignTime: Put an TJvValidateEdit component on a form. Set the DisplayType to dfFloat and try to enter an value like 1.55 or under Text 1.55 and you can see that its now 155. Why this happens? It's seems to happen with all float and/or currency values. DecimalPlaces = 2! This seems to be a great bug, please help me out! Thanks in advance! | ||||
Tags | No tags attached. | ||||
|
Hello everybody, is there someone who can help me out with this really urgent problem? Please... Thanks a lot! |
|
The problem is actually in JvJCLUtils.StrToFloatDef. Change it to: function StrToFloatDef(const Str: string; Def: Extended): Extended; var lStr: string; i:integer; begin lStr := ''; for i := 1 to Length(Str) do if Str[i] in ['0'..'9','-','+', DecimalSeparator] then lStr := LStr + Str[i]; Result := Def; if lStr <> '' then try { the string '-' fails StrToFloat, but it can be interpreted as 0 } if lStr[Length(lStr)] = '-' then lStr := lStr + '0'; { a string that ends in a '.' such as '12.' fails StrToFloat, but as far as I am concerned, it may as well be interpreted as 12.0 } if lStr[Length(lStr)] = DecimalSeparator then lStr := lStr + '0'; if not TextToFloat(PChar(lStr), Result, fvExtended) then Result := Def; except Result := Def; end; end; While you're at it, also change StrToCurrDef in the same unit to: function StrToCurrDef(const Str: string; Def: Currency): Currency; var lStr: string; i:integer; begin lStr := ''; for i := 1 to Length(Str) do if Str[i] in ['0'..'9','-','+', DecimalSeparator] then lStr := LStr + Str[i]; try if not TextToFloat(PChar(lStr), Result, fvCurrency) then Result := Def; except Result := Def; end; end; edited on: 04-07-04 13:18 |
|
Note: I modified the code to set lStr := '' at the beginning |
|
Hello Peter, it seems to work now. Maybe you could add this changes to the CVS? Thanks for you fast support! |
|
Updated in CVS. You are welcome! |
Date Modified | Username | Field | Change |
---|---|---|---|
2004-04-07 08:09 | anonymous | New Issue | |
2004-04-07 13:02 | anonymous | Note Added: 0003692 | |
2004-04-07 13:07 |
|
Note Added: 0003695 | |
2004-04-07 13:07 |
|
Status | new => assigned |
2004-04-07 13:07 |
|
Assigned To | => user72 |
2004-04-07 13:18 |
|
Note Edited: 0003695 | |
2004-04-07 13:19 |
|
Note Added: 0003699 | |
2004-04-07 13:45 | anonymous | Note Added: 0003701 | |
2004-04-07 14:43 |
|
Status | assigned => resolved |
2004-04-07 14:43 |
|
Resolution | open => fixed |
2004-04-07 14:43 |
|
Note Added: 0003702 |