View Issue Details

IDProjectCategoryView StatusLast Update
0003494JEDI VCL00 JVCL Componentspublic2006-06-29 12:53
ReporteresasseAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPCOSWindowsOS VersionXP
Product Version3.10 
Target VersionFixed in Version3.30 
Summary0003494: JvValidateEdit changes negative numbers to positive when DisplayFormat is dfCurrency
DescriptionJvValidateEdit 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.
Steps To Reproduce1 - Set your regional settings to Portuguese (Brazil).
2 - Put a JvValidateEdit in a form among other components so that you can exit the edit and focus something else.
3 - Set DisplayFormat to dfCurrency.
4 - Run the app and type something like -1000 inside it.
5 - Click on another edit, then click back, and now click on another edit again. You'll notice the value changes from "(R$ 1.000,00)" to "R$ 1.000,00".

TagsNo tags attached.

Activities

obones

2006-02-13 04:46

administrator   ~0008543

How exactly does it behaves?
Can you provide steps describing what happens, alongside display examples?

esasse

2006-02-14 04:13

developer   ~0008548

I did provide steps to reproduce. Did you try them?

obones

2006-04-05 06:30

administrator   ~0008971

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.

obones

2006-06-27 05:50

administrator   ~0009674

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.

esasse

2006-06-28 19:47

developer   ~0009719

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.

obones

2006-06-29 04:13

administrator   ~0009720

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)

obones

2006-06-29 04:22

administrator   ~0009721

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.

2006-06-29 05:53

 

JvValidateEdit.pas (43,258 bytes)

obones

2006-06-29 05:56

administrator   ~0009722

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.

esasse

2006-06-29 10:46

developer   ~0009730

I didn't use the file attached, but I have just checked the trunk from SVN and the problem is fixed. Thanks a lot.

obones

2006-06-29 12:53

administrator   ~0009731

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: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