mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
Merged revision(s) 52204 #9a6c33c697, 52206 #16b35167c9 from trunk:
MaskEdit: don't remove the mask in FormatMaskText regardless of the "MaskSave" value in the specified EditMask. ........ MaskEdit: do replace SpaceChar with #32 in FormatMaskText. ........ git-svn-id: branches/fixes_1_6@52276 -
This commit is contained in:
parent
1c99a2ddbb
commit
05b4e376a7
@ -226,6 +226,7 @@ const
|
|||||||
procedure RealSetText(const AValue: TCaption); override;
|
procedure RealSetText(const AValue: TCaption); override;
|
||||||
function RealGetText: TCaption; override;
|
function RealGetText: TCaption; override;
|
||||||
Function GetTextWithoutMask(Value: TCaption) : TCaption;
|
Function GetTextWithoutMask(Value: TCaption) : TCaption;
|
||||||
|
function GetTextWithoutSpaceChar(Value: TCaption) : TCaption;
|
||||||
Procedure SetTextApplyMask(Value: TCaption);
|
Procedure SetTextApplyMask(Value: TCaption);
|
||||||
function GetEditText: string; virtual;
|
function GetEditText: string; virtual;
|
||||||
procedure SetEditText(const AValue: string);
|
procedure SetEditText(const AValue: string);
|
||||||
@ -415,7 +416,9 @@ begin
|
|||||||
if CME.IsMasked then
|
if CME.IsMasked then
|
||||||
begin
|
begin
|
||||||
Result := CME.ApplyMaskToText(Value);
|
Result := CME.ApplyMaskToText(Value);
|
||||||
Result := CME.GetTextWithoutMask(Result);
|
//Delphi 7 leaves in the mask regardless of the "MaskSave" value in the specified EditMaske
|
||||||
|
//but SpaceChar must be replaced by #32
|
||||||
|
Result := CME.GetTextWithoutSpaceChar(Result);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result := Value;
|
Result := Value;
|
||||||
@ -1559,6 +1562,26 @@ Begin
|
|||||||
Result := S;
|
Result := S;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
{
|
||||||
|
Replace al FSPaceChars with #32
|
||||||
|
Leave all mask literals in place
|
||||||
|
Needed by FormatMaskText
|
||||||
|
}
|
||||||
|
function TCustomMaskEdit.GetTextWithoutSpaceChar(Value: TCaption): TCaption;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Begin
|
||||||
|
Result := StringReplace(Value, FSpaceChar, #32, [rfReplaceAll]);
|
||||||
|
//FSpaceChar can be used as a literal in the mask, so put it back
|
||||||
|
for i := 1 to FMaskLength do
|
||||||
|
begin
|
||||||
|
if IsLiteral(FMask[i]) and (FMask[i] = FSpaceChar) then
|
||||||
|
begin
|
||||||
|
SetCodePoint(Result, i, FSpaceChar);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
// Respond to Text Changed message
|
// Respond to Text Changed message
|
||||||
procedure TCustomMaskEdit.TextChanged;
|
procedure TCustomMaskEdit.TextChanged;
|
||||||
|
Loading…
Reference in New Issue
Block a user