procedure Tform1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', #8, #13]) then
key := char(0); //key:=char(' ');//#8是回退键,#13是回车键
if key = #13 then
begin
selectnext(activecontrol, true, true);//跳转到下一个控件
end;
end;
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
edit keypress
if Not (Key in ['0'..'9','.',#13,Char(vk_delete),Char(vk_back)]) then
Key:=#0;
if (Key='.') and (Pos('.',Edit.Text)>0) then key:=#0; |