procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
P: Integer;
begin
if Key in ['0'..'9', '.'] then
begin
P := Pos('.', TEdit(Sender).Text);
if (P <> 0) and ( (P + 1) < (Length(TEdit(Sender).Text) ) then
Key := #0;
end
else
if Key <> #8 then
Key := #0;
end;
Edit컴포넌트의 OnKeyPress에서 아래와 같이 해보세요...
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
P: Integer;
begin
if Key in ['0'..'9', '.'] then
begin
P := Pos('.', TEdit(Sender).Text);
if (P <> 0) and ( (P + 1) < (Length(TEdit(Sender).Text) ) then
Key := #0;
end
else
if Key <> #8 then
Key := #0;
end;
^^ 항상 즐코하세요...