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
0001696 [JEDI VCL] 00 JVCL Components minor always 2004-04-25 08:38 2004-04-27 01:13
Reporter SVitaliy View Status public  
Assigned To user72
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0001696: Exists invalid for TJvSpinEdit.DisplayFormat strings, but valid for Delphi FormatFloat function.
Description The component TJvSpinEdit failed to set value when DisplayFormat contains non-format characters. For example .##’%’.
Possible solution: upgrade function TextToValText in file JvSpinEdit.
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0004072)
user72
2004-04-25 23:40
edited on: 2004-04-25 23:42

Not that I think the current behavior is incorrect (it is a spin edit, not a mask edit), the following should fix it:

function TextToValText(const AValue: string): string;
var i, j:integer;
begin

  Result := DelRSpace(AValue);
  if DecimalSeparator <> ThousandSeparator then
    Result := DelChars(Result, ThousandSeparator);

  if (DecimalSeparator <> '.') and (ThousandSeparator <> '.') then
    Result := ReplaceStr(Result, '.', DecimalSeparator);
  if (DecimalSeparator <> ',') and (ThousandSeparator <> ',') then
    Result := ReplaceStr(Result, ',', DecimalSeparator);

  j := 1;
  for i := 1 to Length(Result) do
    if Result[i] in ['0'..'9', DecimalSeparator] then
    begin
      Result[j] := Result[i];
      Inc(j);
    end;
  SetLength(Result, j - 1);


  if Result = '' then
    Result := '0'
  else
  if Result = '-' then
    Result := '-0';
end;

edited on: 04-25-04 23:42
(0004079)
user72
2004-04-26 06:20

Just to make it clear: I don't think SpinEdit needs to support anything but 0..9, DecimalSeparator (and maybe ThousandsSeparator) since those are the only characters you should be able to put into it.
(0004084)
SVitaliy (reporter)
2004-04-26 09:53

I agree with Your statement.
What You say about defense DisplayFormat against incorrect input?
(0004085)
user72
2004-04-26 10:05

You mean change TextToValText so it just trims out anything invalid and return the rest? I guess that would be feasible...
(0004088)
SVitaliy (reporter)
2004-04-26 11:21

I feel that solution found!
(0004089)
remkobonte (developer)
2004-04-26 17:16

Note that there is an adjusted TextToValText in JvBaseEdits.pas.
(0004091)
user72
2004-04-27 01:13

Fixed in CVS: Fixed TextToValText moved to JvJCLUtils

- Issue History
Date Modified Username Field Change
2004-04-25 08:38 SVitaliy New Issue
2004-04-25 23:40 user72 Note Added: 0004072
2004-04-25 23:41 user72 Note Edited: 0004072
2004-04-25 23:42 user72 Note Edited: 0004072
2004-04-26 05:29 user72 Status new => feedback
2004-04-26 06:20 user72 Note Added: 0004079
2004-04-26 09:53 SVitaliy Note Added: 0004084
2004-04-26 10:05 user72 Note Added: 0004085
2004-04-26 11:21 SVitaliy Note Added: 0004088
2004-04-26 17:16 remkobonte Note Added: 0004089
2004-04-27 01:13 user72 Status feedback => resolved
2004-04-27 01:13 user72 Resolution open => fixed
2004-04-27 01:13 user72 Assigned To => user72
2004-04-27 01:13 user72 Note Added: 0004091


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