1.try strtofloat(edit1.text); showmessage('ok!you input a numeric.'); except showmessage('the input is not been a numeric'); end;2.procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if key=13 then SelectNext(Edit1,false,true); end;
//---------注意:要按焦点跳转顺序设置好每一个EDIT的TAB值。
3. if edit1.Modified then begin end; if edit2.Modified then begin end; ......
try
FloatToStr(Edit1.Text);
Except
ShowMessage('不是数字');
end;2. 最好把组件的顺序先排好,不然每一次回车都要做一次循环判断。
参见SelectNext(),FindComponent(),TabOrder3. 在Edit 的OnChange 事件做个标记
strtofloat(edit1.text);
showmessage('ok!you input a numeric.');
except
showmessage('the input is not been a numeric');
end;2.procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then
SelectNext(Edit1,false,true);
end;
//---------注意:要按焦点跳转顺序设置好每一个EDIT的TAB值。
3. if edit1.Modified then
begin end;
if edit2.Modified then
begin end;
......
2. 前一个EDIT中,用keypress事件,If Key = #13 then Edit2.SetFouse;
3. 你的问题没有说清楚,如果不希望用户修改EDIT,可以将EDIT属性设置为readonly.如果要检查是否改动,也可以用onchange事件来判断。
else
begin
KEY:=#0;
end;
如果只想判断一个Edit里的内容是否改变的话,你可以在窗体显示时先把Edit里的内容保存到一个变量中var1,当程序退出时判断var1中的内容是否与Edit里的内容相同,这样不就可以了吗!