是否在Form的keypress事件中有key := #0;语句啊
formkeypress先于edit1keypress执行
formkeypress先于edit1keypress执行
解决方案 »
- 怎样将sql server中的字段类型转换为DELPHI中的字符串?
- 为何不能存入扩展名为.JPG格式的图片?
- ★★★★★号外!号外!专用delphi资料FTP空间开通,热爱DELPHI资料共享的朋友有福了★★★★★
- 书书。这本书,谁有《Delphi COM深入编程》这本书的电子版啊?哪个教育网可能有吧
- 求救!!!!各位Programmer都是怎样调节自己的状态?
- 高手们请教了,是数据库表之间的关系问题
- ADOConnection.ConnectionString 属性"..."-> build 的问题!
- 数据载入
- 大家来讨论一下调试的技巧和工具!
- :delphi6中自定义属性编辑器所遇到的问题...
- 谁能告诉我
- 在數據模組里,ADOQuery的BeforPost事件中只有TDataset參數,能判斷當前記錄某字段缺少填寫嗎?
PostMessage(edit1.handle.WM_KEYGOWN,VK_TAB,0);
但是我有很多的edit呀!
to:hlilna()
我在edit.onkeypress中:
if not (key in ['0'..'9','.',#8,#13]) then
begin
key := #0;
showmessage('请您勿必输入0-9之间的数字!');
end;在formkeypress中:
if key=#13 then
perform(WM_NEXTDLGCTL,0,0);
为什么不行呀
begin
if Edit1.Text<>'' then
begin
if key = #13 then
begin
Keybd_event(VK_TAB,MapVirtualKey(VK_TAB,0),0,0);
Keybd_event(VK_TAB,MapVirtualKey(VK_TAB,0),KEYEVENTF_KEYUP,0);
end;
end
else begin
if not (key in ['0'..'9','.',#8]) then
begin
key := #0;
showmessage('请您勿必输入0-9之间的数字!');
end;
end;
end;
这样就不要处理FORM的KEYPRESS事件了,给分、
主要是我在点确定按钮的时候还要判断是不是空!
if Trim(Ed_pro_id.Text) = '' then
if application.MessageBox ('请填写产品序号!','提示',MB_OK) = IDOK then
begin
Ed_pro_id.SetFocus ;
exit;
end;
这样的话,敲回车,就显示了下一个edit的message了,为什么?
有什么方法吗?
begin
if Trim(TEdit(Sender).Text) = '' then
if Application.MessageBox ('请填写产品序号!','提示',MB_OK) = IDOK then begin
TEdit(Sender).SetFocus ;
Exit;
end;
end;
procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0','1','2','3','4','5','6','7','8','9']) then
begin
showmessage('');
Abort;
end ;
end;procedure TForm1.Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if comparestr(Edit3.Text,'')=0 then
Abort;
if Key = 13 then
begin
Edit4.SetFocus;
end;
end;
我试过了,不知能否合你的要求
press是在某一东东上发生了down then up
down & up则是分开。