mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 18:50:45 +02:00
MaskEdit: fix FormatMaskText.
git-svn-id: trunk@49197 -
This commit is contained in:
parent
88a5ad88c2
commit
a9060dc0b7
@ -225,7 +225,7 @@ const
|
||||
function RestoreMask(const NewText: String): Boolean;
|
||||
procedure RealSetText(const AValue: TCaption); override;
|
||||
function RealGetText: TCaption; override;
|
||||
Function GetTextWithoutMask : TCaption;
|
||||
Function GetTextWithoutMask(Value: TCaption) : TCaption;
|
||||
Procedure SetTextApplyMask(Value: TCaption);
|
||||
function GetEditText: string; virtual;
|
||||
procedure SetEditText(const AValue: string);
|
||||
@ -411,7 +411,13 @@ begin
|
||||
CME := TCustomMaskEdit.Create(nil);
|
||||
try
|
||||
CME.EditMask := AEditMask;
|
||||
if CME.IsMasked then
|
||||
begin
|
||||
Result := CME.ApplyMaskToText(Value);
|
||||
Result := CME.GetTextWithoutMask(Result);
|
||||
end
|
||||
else
|
||||
Result := Value;
|
||||
finally
|
||||
CME.Free;
|
||||
end;
|
||||
@ -1063,10 +1069,9 @@ end;
|
||||
|
||||
function TCustomMaskEdit.RealGetText: TCaption;
|
||||
begin
|
||||
if not IsMasked then
|
||||
Result := inherited RealGetText //don't call GetEditText here (issue #0026924)
|
||||
else
|
||||
Result := GetTextWithoutMask;
|
||||
Result := inherited RealGetText; //don't call GetEditText here (issue #0026924)
|
||||
if IsMasked then
|
||||
Result := GetTextWithoutMask(Result);
|
||||
end;
|
||||
|
||||
// Set the actual Text
|
||||
@ -1515,7 +1520,7 @@ end;
|
||||
|
||||
|
||||
// Get the actual Text
|
||||
function TCustomMaskEdit.GetTextWithoutMask: TCaption;
|
||||
function TCustomMaskEdit.GetTextWithoutMask(Value: TCaption): TCaption;
|
||||
{
|
||||
Replace al FSPaceChars with #32
|
||||
If FMaskSave = False then do trimming of spaces and remove all maskliterals
|
||||
@ -1524,13 +1529,7 @@ var
|
||||
S: String;
|
||||
i: Integer;
|
||||
Begin
|
||||
if not IsMasked then
|
||||
begin
|
||||
Result := inherited RealGetText;
|
||||
end
|
||||
else
|
||||
begin
|
||||
S := StringReplace(inherited RealGetText, FSpaceChar, #32, [rfReplaceAll]);
|
||||
S := 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
|
||||
@ -1553,7 +1552,6 @@ Begin
|
||||
end;//case
|
||||
end;
|
||||
Result := S;
|
||||
end;
|
||||
End;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user