5
I need to format an Edit in the format 0,00 in Firemonkey, using preferably the event ChangeTracking.
I tried to use the following procedure that did not resolve.
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;
Try Tedit Ontyping Event
– Jefferson Rudolf