View Issue Details

IDProjectCategoryView StatusLast Update
0004582JEDI VCL04 Feature Requestpublic2009-08-07 11:16
ReporterPedraultAssigned Toobones 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.35 
Target VersionFixed in Version3.38 
Summary0004582: Add another float display with the TJvValidateEdit
DescriptionPlease add the '%.*f' display format into the TJvValidateEdit! I think it should be very interesting for users.
TagsDecimalSeparator, Float, JVCL, JvValidateEdit

Activities

Pedrault

2008-11-12 14:56

reporter   ~0014996

I think there are some interseting features to be added like the interception of non valid chars. At this time, the TJvValidateEdit just check the value when we exit the component. So, the user can type values like '1..........1235'

obones

2008-12-22 04:36

administrator   ~0015140

Please try to provide the implementation for this

Pedrault

2008-12-22 09:10

reporter   ~0015174

ok
I'll do it ASAP

obones

2009-07-09 17:10

administrator   ~0015821

Any news?

Pedrault

2009-07-09 19:56

reporter   ~0015836

Sorry, I was too busy to do that...
As I promised, I'll do it ASAP ;)

2009-07-09 21:52

 

JvValidateEdit.pas (48,078 bytes)

Pedrault

2009-07-09 21:57

reporter   ~0015837

Here it is...

I've added the dfNaturalFloat (I haven't found a better name :P ) display format.

For the other problem, there was a bug in the TJvCustomValidateEdit.IsValidChar function. For each display format which use decimal separator (dfCurrency, dfFloat, ...), there is this test which test the validity of the char:

Result := (Pos(Key, FCheckChars) > 0) or
  ((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or ...

But, at this time, the FCheckChars variable is '0123456789.'. So, even there already is a decimal separator in the text, this test will return true anyway.

I've changed to this:

Result := ((Pos(Key, FCheckChars) > 0) and (((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or ...

Pedrault

2009-07-09 22:00

reporter   ~0015838

Uh Oh...
I forgot a unused variable and I cannot delete the uplodaed file to replace with the correct one...

obones

2009-08-05 11:09

administrator   ~0015921

Could you provide a diff file instead? It will make integration much easier as JvValidateEdit.pas has changed quite a bit in between

Pedrault

2009-08-05 18:36

reporter   ~0015939

All right! I'll install the latest public version and I'll make the modifications on it.

Pedrault

2009-08-05 19:03

reporter   ~0015940

What do you call a "diff file"?

obones

2009-08-06 10:40

administrator   ~0015947

A diff file is a text file that describes the changes that you made to another file with respect to its original version. As it includes a bit of context but only the differences, it makes it easier for us (and our tools) to apply those changes to the current version of the file.
More info on the Diff tool here:
http://en.wikipedia.org/wiki/Diff

Usually, we ask people to create a diff file with TortoiseSVN when they are using a SVN based repository. This is described here:
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html#tsvn-dug-patch-1

If you are not able to do so, could you at least tell us the version of JVCL in which you modified the file?

2009-08-06 22:46

 

JvValidateEdit.diff (4,699 bytes)
32c32
< unit JvValidateEdit;
---
> unit JvValidateEdit_Modified;
50c50
<     dfIdentifier);
---
>     dfIdentifier, dfNaturalFloat);
581c581
<   if FDisplayFormat in [dfCurrency, dfFloat, dfFloatGeneral, dfScientific, dfPercent] then
---
>   if FDisplayFormat in [dfCurrency, dfFloat, dfFloatGeneral, dfScientific, dfPercent, dfNaturalFloat] then
642c642
<       dfFloat, dfFloatGeneral, dfPercent, dfDecimal:
---
>       dfFloat, dfFloatGeneral, dfPercent, dfDecimal, dfNaturalFloat:
686c686
<       (NewValue in [dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
---
>       (NewValue in [dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) then
689c689
<     if (OldFormat in [dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfPercent]) and
---
>     if (OldFormat in [dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfPercent, dfNaturalFloat]) and
694c694
<       (NewValue in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
---
>       (NewValue in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) then
702c702
<       (NewValue in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfHex, dfInteger, dfPercent, dfScientific, dfYear]) then
---
>       (NewValue in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfHex, dfInteger, dfPercent, dfScientific, dfYear, dfNaturalFloat]) then
749c749
<     dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfPercent, dfScientific, dfYear:
---
>     dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfPercent, dfScientific, dfYear, dfNaturalFloat:
780c780
<     dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfPercent, dfScientific, dfYear:
---
>     dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfPercent, dfScientific, dfYear, dfNaturalFloat:
834a835,836
>     dfNaturalFloat:
>       EditText := Format('%.*f', [FDecimalPlaces, FloatRangeValue(NewValue)]);
853c855
<     dfFloat, dfFloatGeneral, dfDecimal, dfPercent, dfScientific:
---
>     dfFloat, dfFloatGeneral, dfDecimal, dfPercent, dfScientific, dfNaturalFloat:
882c884
<     dfCurrency, dfFloat, dfDecimal, dfFloatGeneral, dfPercent, dfScientific:
---
>     dfCurrency, dfFloat, dfDecimal, dfFloatGeneral, dfPercent, dfScientific, dfNaturalFloat:
965,967c967,969
<     dfFloat, dfFloatGeneral, dfDecimal, dfPercent:
<       Result := ((Pos(Key, FCheckChars) > 0) and 
<         (((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or
---
>     dfFloat, dfFloatGeneral, dfDecimal, dfPercent, dfNaturalFloat:
>       Result := ((Pos(Key, FCheckChars) > 0) and (((Key = DecimalSeparator) and
>         (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or
1007,1008c1009,1010
<         Result := ((Pos(Key, FCheckChars) > 0) and 
<           (((Key = DecimalSeparator) and (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or
---
>         Result := ((Pos(Key, FCheckChars) > 0) and (((Key = DecimalSeparator) and
>           (Pos(DecimalSeparator, S) = 0)) or (Key <> DecimalSeparator))) or
1119c1121
<     dfOctal, dfPercent, dfScientific, dfYear]) then
---
>     dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) then
1202c1204
<   if (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) and
---
>   if (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfInteger, dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) and
1219a1222,1223
>       dfNaturalFloat:
>         ChangeText(Format('%.*f', [FDecimalPlaces, FormatedValue(AsFloat)]));
1227c1231
<       (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
---
>       (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) then
1391c1395
<     dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) and
---
>     dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) and
1407c1411
<     dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) and
---
>     dfDecimal, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear, dfNaturalFloat]) and
JvValidateEdit.diff (4,699 bytes)

Pedrault

2009-08-06 22:46

reporter   ~0015952

OK, so I've created a Diff file with WinMerge from the last version (3.37) of the JVCL.
Is it the good diff format?

obones

2009-08-07 09:24

administrator   ~0015953

It's not the best format for me to work with, but it's good enough for the purpose at hand. I'll analyze it and will post the result in the SVN as soon as I can

obones

2009-08-07 11:16

administrator   ~0015954

Thanks, this is now in SVN, under the "dfFloatFixed" format.
The checkcars patch is not in as many changes were made in the latest revisions.

Issue History

Date Modified Username Field Change
2008-11-12 14:04 Pedrault New Issue
2008-11-12 14:56 Pedrault Note Added: 0014996
2008-11-18 08:33 obones Status new => acknowledged
2008-12-22 04:36 obones Note Added: 0015140
2008-12-22 04:36 obones Status acknowledged => feedback
2008-12-22 09:10 Pedrault Note Added: 0015174
2009-07-09 17:10 obones Note Added: 0015821
2009-07-09 19:56 Pedrault Note Added: 0015836
2009-07-09 21:52 Pedrault File Added: JvValidateEdit.pas
2009-07-09 21:57 Pedrault Note Added: 0015837
2009-07-09 22:00 Pedrault Note Added: 0015838
2009-07-09 22:01 Pedrault Tag Attached: JVCL
2009-07-09 22:01 Pedrault Tag Attached: DecimalSeparator
2009-07-09 22:01 Pedrault Tag Attached: Float
2009-07-09 22:01 Pedrault Tag Attached: JvValidateEdit
2009-08-05 11:09 obones Note Added: 0015921
2009-08-05 18:36 Pedrault Note Added: 0015939
2009-08-05 19:03 Pedrault Note Added: 0015940
2009-08-06 10:40 obones Note Added: 0015947
2009-08-06 22:46 Pedrault File Added: JvValidateEdit.diff
2009-08-06 22:46 Pedrault Note Added: 0015952
2009-08-07 09:24 obones Note Added: 0015953
2009-08-07 11:16 obones Note Added: 0015954
2009-08-07 11:16 obones Status feedback => resolved
2009-08-07 11:16 obones Fixed in Version => Daily / SVN
2009-08-07 11:16 obones Resolution open => fixed
2009-08-07 11:16 obones Assigned To => obones