From: <ob...@us...> - 2009-09-22 13:30:44
|
Revision: 12508 http://jvcl.svn.sourceforge.net/jvcl/?rev=12508&view=rev Author: obones Date: 2009-09-22 13:30:33 +0000 (Tue, 22 Sep 2009) Log Message: ----------- Mantis 4952: CurrencyString and DisplaySuffix/DisplayPrefix can contain a character that is the same as the DecimalSeparator value, thus preventing from entering it a second time Modified Paths: -------------- trunk/jvcl/run/JvValidateEdit.pas Modified: trunk/jvcl/run/JvValidateEdit.pas =================================================================== --- trunk/jvcl/run/JvValidateEdit.pas 2009-09-19 12:03:14 UTC (rev 12507) +++ trunk/jvcl/run/JvValidateEdit.pas 2009-09-22 13:30:33 UTC (rev 12508) @@ -1,4 +1,4 @@ -{----------------------------------------------------------------------------- +{----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -836,8 +836,16 @@ end; procedure TJvCustomValidateEdit.KeyPress(var Key: Char); +var + StrippedText: string; begin - if not IsValidChar(Text, Key, SelStart + 1) and (Key >= #32) then + // Mantis 4952: + // - Must not take the prefix/suffix into account when checking a character's validity + // - Must not take into account the CurrencyString into account when checking a character's validity + StrippedText := StrEnsureNoPrefix(DisplayPrefix, StrEnsureNoSuffix(DisplaySuffix, Text)); + StrippedText := StrEnsureNoPrefix(CurrencyString, StrEnsureNoSuffix(CurrencyString, StrippedText)); + + if not IsValidChar(StrippedText, Key, SelStart + 1) and (Key >= #32) then Key := #0; inherited KeyPress(Key); end; @@ -1107,6 +1115,8 @@ DisplayedText := inherited Text; DisplayedText := StrEnsureNoPrefix(DisplayPrefix, DisplayedText); DisplayedText := StrEnsureNoSuffix(DisplaySuffix, DisplayedText); + DisplayedText := StrEnsureNoPrefix(CurrencyString, DisplayedText); + DisplayedText := StrEnsureNoSuffix(CurrencyString, DisplayedText); EditText := DisplayedText; end; inherited FocusKilled(NextWnd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |