Thema: Delphi Eingabe beschränken

Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#5
  Alt 31. Dez 2002, 19:19
So auf die Schnelle:
Delphi-Quellcode:
var
  Comma : Boolean = FALSE;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if (Comma = TRUE) and (Key = #44) then
    key := #0;
  if pos(',', Edit1.Text) > 0 then
    Comma := TRUE
  else
    Comma := FALSE;
  if not (Key in [#8,#44,#48 .. #57]) then Key := #0
end;
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat