View Issue Details

IDProjectCategoryView StatusLast Update
0003713JEDI VCL04 Feature Requestpublic2006-06-07 03:30
ReporterscaddenAssigned Toobones 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.30 
Summary0003713: Add a "dfFloatGeneral" facility to JvValidateEdit.pas
DescriptionOne of my pet hates with floating point controls is the assumption of fixed
decimal places. All I really want is a control where you can only enter a floating point number into it, no letters.

Anyway, I proposed that TJvValidateEdit support another format
call it dfFloatGeneral.

The crucial change is in DisplayText and need to add:

      dfFloat:
        ChangeText(Format('%.*n', [FDecimalPlaces, AsFloat]));
      dfFloatGeneral:
        ChangeText(Format('%.*g', [FDecimalPlaces, AsFloat]));

The %g is my ideal floating point formater. FDecimalplaces is being
interpreted as the precision to display. Makes it easy to enter and display in the same control,
9.1, 0.0005, 5.00000001 etc.

Additional InformationDiff file for changes is
Compare: (<)C:\CompD7\jvcl\run\JvValidateEdit.pas (37848 bytes)
   with: (>)C:\Documents and Settings\scaddenp\Local Settings\Temp\JvValidateEdit.pas (37479 bytes)

48c48
< dfCheckChars, dfCurrency, dfCustom, dfFloat, dfFloatGeneral, dfHex, dfInteger,
---
> dfCheckChars, dfCurrency, dfCustom, dfFloat, dfHex, dfInteger,
419c419
< if FDisplayFormat in [dfCurrency, dfFloat, dfFloatGeneral, dfScientific, dfPercent] then
---
> if FDisplayFormat in [dfCurrency, dfFloat, dfScientific, dfPercent] then
474c474
< dfFloat, dfPercent, dfFloatGeneral:
---
> dfFloat, dfPercent:
518,521c518,521
< (NewValue in [dfCurrency, dfFloat, dfFloatGeneral, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
< SetAsInteger(BaseToInt(FEditText, 2))
< else
< if (OldFormat in [dfCurrency, dfFloat, dfFloatGeneral, dfPercent]) and
---
> (NewValue in [dfCurrency, dfFloat, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
> SetAsInteger(BaseToInt(FEditText, 2))
> else
> if (OldFormat in [dfCurrency, dfFloat, dfPercent]) and
526c526
< (NewValue in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
---
> (NewValue in [dfBinary, dfCurrency, dfFloat, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
534c534
< (NewValue in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfHex, dfInteger, dfPercent, dfScientific, dfYear]) then
---
> (NewValue in [dfBinary, dfCurrency, dfFloat, dfHex, dfInteger, dfPercent, dfScientific, dfYear]) then
581c581
< dfCurrency, dfFloat,dfFloatGeneral, dfInteger, dfPercent, dfScientific, dfYear:
---
> dfCurrency, dfFloat, dfInteger, dfPercent, dfScientific, dfYear:
612c612
< dfCurrency, dfFloat, dfFloatGeneral,dfInteger, dfPercent, dfScientific, dfYear:
---
> dfCurrency, dfFloat, dfInteger, dfPercent, dfScientific, dfYear:
646c646
< dfCurrency, dfFloat, dfPercent, dfFloatGeneral:
---
> dfCurrency, dfFloat, dfPercent:
658c658
< dfFloat, dfFloatGeneral, dfPercent, dfScientific:
---
> dfFloat, dfPercent, dfScientific:
678c678
< dfCurrency, dfFloat, dfFloatGeneral, dfPercent, dfScientific:
---
> dfCurrency, dfFloat, dfPercent, dfScientific:
741c741
< dfFloat, dfFloatGeneral, dfCurrency, dfPercent:
---
> dfFloat, dfCurrency, dfPercent:
844c844
< if FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral,dfHex, dfInteger,
---
> if FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfHex, dfInteger,
912c912
< else if (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) and
---
> else if (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) and
924,925d924
< dfFloatGeneral:
< ChangeText(Format('%.*g', [FDecimalPlaces, AsFloat]));
937c935
< (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfFloatGeneral,dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
---
> (FDisplayFormat in [dfBinary, dfCurrency, dfFloat, dfHex, dfInteger, dfOctal, dfPercent, dfScientific, dfYear]) then
1083c1081
< if FHasMaxValue and (FDisplayFormat in [dfBinary, dfCurrency, dfFloat,dfFloatGeneral,
---
> if FHasMaxValue and (FDisplayFormat in [dfBinary, dfCurrency, dfFloat,
1092c1090
< if FHasMinValue and (FDisplayFormat in [dfBinary, dfCurrency, dfFloat,dfFloatGeneral,
---
> if FHasMinValue and (FDisplayFormat in [dfBinary, dfCurrency, dfFloat,
TagsNo tags attached.

Activities

2006-05-17 20:07

 

JvValidateEdit.pas (37,848 bytes)

obones

2006-05-21 09:37

administrator   ~0009335

Can you attach the diff file instead of posting it?

obones

2006-06-07 03:30

administrator   ~0009403

This is now in SVN

Issue History

Date Modified Username Field Change
2006-05-17 20:07 scadden New Issue
2006-05-17 20:07 scadden File Added: JvValidateEdit.pas
2006-05-21 09:37 obones Note Added: 0009335
2006-05-21 09:37 obones Status new => feedback
2006-06-07 03:30 obones Status feedback => resolved
2006-06-07 03:30 obones Resolution open => fixed
2006-06-07 03:30 obones Assigned To => obones
2006-06-07 03:30 obones Note Added: 0009403