Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
Delphi 10.2 Tokyo Professional
|
AW: Komma automatisch setzen bei Geldbetrag im Edit
24. Aug 2011, 16:15
Hallo,
So funktioniert es:
Delphi-Quellcode:
procedure TForm1.Edit1Change(Sender: TObject);
var Text: String;
Sel: Integer;
begin
Sel := Edit1.SelStart;
Text := StringReplace(Edit1.Text,',','',[rfReplaceAll]);
if Length(Text) > 2 then
begin
Insert(',',Text,Length(Text)-1);
if Sel > Length(Text)-2 then
inc(Sel);
end;
Edit1.Text := Text;
Edit1.SelStart := Sel;
end;
Michael "Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
Geändert von Neutral General (24. Aug 2011 um 16:19 Uhr)
|
|
Zitat
|