怎么搞的,居然捕捉不到回车键,:(怎么没有人肯帮我吗?这个问题看上去不算难嘛) (50分)

将界面属性keyPreview设为true,就可以在onkeypress中捕获key=#13了
 
来自:beta, 时间:2002-6-21 23:56:00, ID:1176594 | 编辑
在 Application 的 OnMessage 里面捕捉:

Application.OnMessage := ApplicationMessage;
...
procedure TForm1.ApplicationMessage(var Msg: tagMSG
var Handled: Boolean);
begin
if (Msg.message = wm_KeyDown) and (Msg.wParam = vk_Return) and
(ActiveControl is TDBEdit) then
begin
ShowMessage('捕捉到了,来自:' + ActiveControl.Name);
Handled := True
// 表示不发送回去,可根据自己需要设定该值
end;
end;

 
你帮我up,我也帮你up。你的问题我除了自己继存CtrlGrid控件以截获回车消息外,没有什么好的建议
 
检测key值。。代替用tab跳格健。。
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
601
import
I
I
回复
0
查看
654
import
I
顶部