Самый простой способ, напишите процедуру.
Код:
procedure TForm3.EditText(CurEdit : TEdit; var Key : Char);
begin
case Key of
'0'..'9', #8:;
'.',',': begin
Key := DecimalSeparator;
if Pos(DecimalSeparator,CurEdit.Text)<>0 then Key := #0;
end;
else Key:= #0;
end;
end;
А после вызывать:
Код:
procedure TForm3.sEdit2KeyPress(Sender: TObject; var Key: Char);
begin
EditText(sEdit2, Key);
end;
Сам попробовал, все работает
