“-”的OnKeydown不会在Delphi 7应用程序中被解雇 [英] OnKeydown for "-" does not get fired in Delphi 7 application

查看:84
本文介绍了“-”的OnKeydown不会在Delphi 7应用程序中被解雇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Delphi 7企业版,该应用程序是在Windows XP上构建的,并在Windows XP和Windows 7上进行了测试。

We are using Delphi 7 enterprise edition, application is build on windows XP, testing on both Windows XP and Windows 7.

在我们维护的应用程序中,有些奇怪正在发生。由于某种原因,按-键(qwerty布局,位于顶部的 0和 =键之间)根本没有注册。

In an application we maintain, something strange is happening. For some reason hitting the "-" key (qwerty layout, between "0" and "=" keys on top) does not register at all.

我们在我们发现编辑的OnKeyDown,表单的OnKeyDown(带有和不带有键预览),甚至是ProcessMessage例程,但是此键的事件从未到达应用程序。
对于OnKeyPress,我们得到的结果相同。

We checked in the OnKeyDown of the edit we found it with, the OnKeyDown of the form (with and without key preview) and even the ProcessMessage routine, but the event for this key never reaches the application. We get the same results for OnKeyPress.

是的,数字键盘上的-键可以工作。此外,此行为仅在此应用程序中可见,但是如果我们创建一个新应用程序,并且仅在unit1.pas中实现了默认表单的OnKeyDown。

Yes, the "-" key on the numpad DOES work. Also, this behavior is only seen in this application, but if we create a new application with only the OnKeyDown of the default form in unit1.pas implemented. it does work.

因此,我们设法以某种方式告诉应用程序正确忽略此键。
是否有人知道如何完成此操作?

So somehow we managed to tell the application to properly ignore this one key. Does anyone have an idea how this could be (un)done?

推荐答案

David的评论正确无误;您可以(使用版本控制)剥离应用程序,直到了解发生了什么。但是,我认为您还需要理解以下概念:

David's comment is on the right track; You can (with version control) strip back the app until you understand what is going on. However I think that you need to understand the following concepts as well:


  1. OnKeyDown事件不是唯一的形式键盘快捷键可能会消失。您应该找出它的去向,这就是Sertac的评论在那里的原因。

  1. OnKeyDown event in a form is not the only place that keyboard shortcuts could go. You should find out where else it's going to, which is why Sertac's comment is there.

您的应用程序之外的某些东西可能会捕获该键盘键(

It is possible that something OUTSIDE your application is trapping that keyboard key (although this is more common with Control or Alt + Key combinations).

您的表单中或应用程序中的其他地方可能正在抢那个键并食用它。

It is possible that something inside your form, or elsewhere in your application is grabbing that key and consuming it.

这里有一篇很好的文章,关于 KeyPreview ,您也需要了解这一点。

There is a good article here about KeyPreview, you need to understand that too.

这篇关于“-”的OnKeydown不会在Delphi 7应用程序中被解雇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆