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
0003494 [JEDI VCL] 00 JVCL Components minor always 2006-02-07 06:09 2006-06-29 12:53
Reporter esasse View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.10
Summary 0003494: JvValidateEdit changes negative numbers to positive when DisplayFormat is dfCurrency
Description JvValidateEdit changes negative numbers to positive as you enter it when DisplayFormat is dfCurrency.

Here in Brazil, the negative currency format is: (R$ 1.000,00) for -1000.
I think the problem is related to this.
Additional Information
Tags No tags attached.
Attached Files ? file icon JvValidateEdit.pas [^] (43,258 bytes) 2006-06-29 05:53

- Relationships

-  Notes
(0008543)
obones (administrator)
2006-02-13 04:46

How exactly does it behaves?
Can you provide steps describing what happens, alongside display examples?
(0008548)
esasse (developer)
2006-02-14 04:13

I did provide steps to reproduce. Did you try them?
(0008971)
obones (administrator)
2006-04-05 06:30

can you try again with the latest version?
I have read your steps, but the thing is that I don't have the kind of local settings you have so it's a bit difficult to test.
(0009674)
obones (administrator)
2006-06-27 05:50

In the JvValidateEdit.pas file, in TJvCustomValidateEdit.GetValue (around line 700), there is a "case" statement with a section for dfCurrency. Replace the line

Result := StrToCurrDef(FEditText, 0);

by these lines

begin
  VarCyFromStr(FEditText, LOCALE_USER_DEFAULT, 0, Cur);
  Result := Cur;
end;

Where Cur is a locally defined variable of type Currency. On top of this you should add VarUtils in the list of uses.
This should work much better for you, please let me know how that goes so that I can commit it into SVN.
(0009719)
esasse (developer)
2006-06-28 19:47

Didn't work. The problem continues.

And I've set a breakpoint to the GetValue and it's never fired. I've also set a breakpoint in other places to make sure I was changing the right unit and methods like Change are fired, so I think I did change the right unit.
(0009720)
obones (administrator)
2006-06-29 04:13

Ok, there was another place where StrToFloatDef was used, it's in the GetAsFloat method. There as well you need to add a new case for dfCurrency and use VarCyFromStr.
I have attached the modified unit to this report, please use it and let me know (and please do not modify the state of the unit, feedback is fine)
(0009721)
obones (administrator)
2006-06-29 04:22

Well, ok, there is one other thing. When leaving a JvValidateEdit with a negative value in, without having changed it, it will go from negative to positive (the parenthesis disappear). I'm working on this.
(0009722)
obones (administrator)
2006-06-29 05:56

Ok, I found out why it would loose the sign when focusing out of the control. It's in the MakeValid function that calls IsValidChar. The case for dfCurrency completely ignored the fact that a negative value can be formatted differently from "-111.111"
I have changed that, please use the newly attached file (dated 06-29-06 05:53, server time) and let me know how it goes so that I can mark the issue as resolved. These changes will go in SVN tonight (paris time) and will be checked for compatibility with D5/C5 later this evening.
(0009730)
esasse (developer)
2006-06-29 10:46

I didn't use the file attached, but I have just checked the trunk from SVN and the problem is fixed. Thanks a lot.
(0009731)
obones (administrator)
2006-06-29 12:53

Excellent, glad to hear that. The attached file does not have the VCL5 compatibility adjustements, I recommend everyone uses the file from SVN.

- Issue History
Date Modified Username Field Change
2006-02-07 06:09 esasse New Issue
2006-02-13 04:46 obones Note Added: 0008543
2006-02-13 04:46 obones Status new => feedback
2006-02-14 04:13 esasse Note Added: 0008548
2006-04-05 06:30 obones Note Added: 0008971
2006-06-27 05:50 obones Note Added: 0009674
2006-06-28 19:45 esasse Issue Monitored: esasse
2006-06-28 19:47 esasse Note Added: 0009719
2006-06-28 19:50 esasse Status feedback => new
2006-06-29 04:13 obones Note Added: 0009720
2006-06-29 04:13 obones Assigned To => obones
2006-06-29 04:13 obones Status new => feedback
2006-06-29 04:14 obones File Added: JvValidateEdit.pas
2006-06-29 04:22 obones Note Added: 0009721
2006-06-29 04:22 obones Status feedback => confirmed
2006-06-29 05:53 obones File Deleted: JvValidateEdit.pas
2006-06-29 05:53 obones File Added: JvValidateEdit.pas
2006-06-29 05:56 obones Note Added: 0009722
2006-06-29 10:46 esasse Note Added: 0009730
2006-06-29 12:53 obones Status confirmed => resolved
2006-06-29 12:53 obones Fixed in Version => Daily / SVN
2006-06-29 12:53 obones Resolution open => fixed
2006-06-29 12:53 obones Note Added: 0009731


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