I need to format an edit in the format 0,00
in FireMonkey , preferably using the ChangeTracking
event.
I tried using the following procedure that did not work.
procedure FormatadorMoeda(pEdit: TEdit);
var
loStr: string;
loDouble: double;
begin
loStr := pEdit.Text;
if loStr = EmptyStr then
loStr := '0,00';
loStr := Trim(StringReplace(loStr, '.', '', [rfReplaceAll, rfIgnoreCase]));
loStr := Trim(StringReplace(loStr, ',', '', [rfReplaceAll, rfIgnoreCase]));
loDouble := StrToFloat(loStr);
loDouble := (loDouble / 100);
pEdit.Text := FormatFloat('###,##0.00', loDouble);
pEdit.SelStart := Length(pEdit.Text);
end;