View Issue Details

IDProjectCategoryView StatusLast Update
0002936JEDI VCL00 JVCL Componentspublic2005-05-12 11:52
ReporterglchapmanAssigned Tooutchy 
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.10 
Summary0002936: JvValidateEdit problems
DescriptionIn working with TJvValidateEdit today, I ran into a few issues (some of these are from scanning the source, I haven't actually confirmed them):

1) Assign method will always raise exception because it always calls inherited method (same thing with TJvValidateEditCriticalPoints).

2) Handling of CheckChars is odd because some DisplayFormats set it but then ignore it (dfAlphabetic and dfAlphaNumeric), while others set it but then allow other chars (the various numeric formats). Also, since CountChars will generally be serialized before DisplayFormat (that's the way they are declared), attempts to use dfCheckChars with a custom set of chars will generally fail, because the assignment to CheckChars when loading is rejected (at that point, the DisplayFormat is still the default dfInteger). My suggestion would be to reserve CheckChars for the dfCheckChars and dfNonCheckChars formats. The other formats should simply ignore it. Changes to CheckChars would always be allowed, but they would only affect the text for the two relevant formats.

3) Setting DisplayFormat to dfCheckChars or dfNonCheckChars always sets Alignment to taLeftJustify, even if AutoAlignment is false (this is especially annoying because it happens when loading a form, so you have to manually reset to e.g. taRightAlignment).

4) When IsValidChar is called by KeyPress, Posn is 0-based (it comes from SelStart). When IsValidChar is called by MakeValid, Posn is 1-based.

5) In IsValidChar, for formats other than dfScientific, why is the sign char not simply limited to position 0 (or position 1 depending on how 0000004 is resolved)?

6) In IsValidChar, dfScientific is allowing a fraction in the exponent (i.e., 1e0.5, which is the square root of 10). This appears to be intentional (see ScientificStrToFloat), but it is not documented and is used inconsistently (GetValue, for example, uses StrToFloatDef, which does not understand fractional exponents).

7) ChangeText neglects to take account of a potential exponent, so that (with dfScientific) '0.0E+000' becomes '0.0E+' when TrimDecimals is changed from False to True.

8) IntToBase is used by SetAsInteger (the setter for the public AsInteger property), but it does not check to see if it got a negative number (with dfHex, setting Value to -1 displays as '6').
TagsNo tags attached.



2005-05-12 11:50

administrator   ~0007143

1) Assign was fixed some days ago by Andreas Hausladen

2) Calling a windows function is more valuable than looking for the character in the string because it takes care of the locale (set in the control panel). Many languages may allow other characters than 'a'..'z' and 'A'..'Z'

3) This is a bug, updated in the CVS.

4) After reading the IsValidChar, PosN should be 1-Based (because Pos is 1-based), so I modified the KeyPress to be 1-based.

5) Changed too.

6) You're right, the line '((Posn > iPosE) and (Pos(DecimalSeparator, Copy(S, iPosE + 1, Length(S))) = 0));' is now in coments.

7) ChangeText now starts at the character preceding the exponent.

8) I changed IntToBaseChar to handle negative numbers correctly


2005-05-12 11:52

administrator   ~0007144

File is updated in the CVS

Issue History

Date Modified Username Field Change
2005-05-07 20:58 glchapman New Issue
2005-05-12 11:50 outchy Note Added: 0007143
2005-05-12 11:52 outchy Status new => resolved
2005-05-12 11:52 outchy Resolution open => fixed
2005-05-12 11:52 outchy Assigned To => outchy
2005-05-12 11:52 outchy Note Added: 0007144