我的 delphi 应用程序与本机键盘不兼容。我应该怎么办?
我的 delphi 应用程序与本机键盘不兼容。我应该怎么办? 要解释更多信息,首先看这些图片:
这是意大利语键盘的外观图像: http://en.wikipedia.org/wiki/Keyboard_layout#Italian
您可以找到同一页面中的普通键盘(美国键盘)。
如果我们使用普通键盘按 Shift+2(或任何 Shift+数字),则必须写入 @,但如果我们使用意大利语键盘,则必须写入 "但在我的应用程序中,使用两个键盘时,它将每个键盘视为普通键盘! 例如,当我在意大利语键盘中按 Shift+2 时,它会输入 @ 而不是“
我正在使用 Delphi 7。您可以在这里测试我的应用程序:en.apadanasoftware.com/forums
提前 Thnx
My delphi application is incompatible with native keyboards. What should I do?
To explain more, first look at these pictures:
Here's an image of what an Italian keyboard looks like:
http://en.wikipedia.org/wiki/Keyboard_layout#Italian
You can find the normal one (United States keyboard) in the same page.
If we press the Shift+2 (or any Shift+Number) with the normal keyboard a @ must be written but if we do it with the Italian keyboard a " must be written. But in my application, with both keyboards, it treats every keyboard as a normal keyboard!
for example when I press Shift+2 within the Italian keyboard, it types @ instead of "
I'm using Delphi 7. You can test my app here: en.apadanasoftware.com/forums
Thnx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
发送到 Delphi 应用程序的字符由 Windows 控制,而不是 Delphi,唯一可能的例外是如果您拦截 Windows 消息并执行自定义键处理。
如果您将两个键盘连接到同一台电脑,这可能是由于窗口加载了错误的键盘布局造成的。
在 Windows 中,转到“控制面板/区域和语言选项”,然后在“语言”选项卡下,按“文本服务和输入语言”组框中的“详细信息”按钮,您应该能够看到已加载和加载的键盘布局如果需要的话,在新的中。
如何从 Microsoft 更改键盘布局
The characters that are sent to your Delphi application are controlled by Windows, not Delphi, the only possible exception to this is if you are intercepting the windows messages and preforming custom key handling.
If you are connecting both keyboards to the same PC, this may be caused by windows having the wrong keyboard layout loaded.
In Windows Go to "Control Panel/ Regional and Language Options" then under the Languages tab, press the Details button in the "Text services and input languages" group box, there you should be able to see what keyboard layouts you have loaded and load in new ones, if needed.
How to change your keyboard layout from Microsoft
您在应用程序中的哪里接收键盘事件?
如果您使用 OnKeyPress 事件,
您将收到“@”键:即转换由 Windows 完成。
如果您使用 OnKeyDown 事件,
您将收到虚拟键代码,即原始键代码,并且您必须使用 Shift 值对其进行转换。
请参阅 http://msdn.microsoft.com/en- us/library/dd375731(VS.85).aspx 关于虚拟按键。
我猜您在应用程序中使用了 OnKeyDown 而不是 OnKeyPress。
Where do you receive the keyboard event in your application?
If you use a OnKeyPress event, like
you will receive the key as '@': i.e. the conversion is done by Windows.
If you use a OnKeyDown event, like
you'll receive the virtual key code, i.e. the raw key code, and you'll have to convert it using the Shift value.
See http://msdn.microsoft.com/en-us/library/dd375731(VS.85).aspx about virtual keys.
I guess you used OnKeyDown instead of OnKeyPress in your application.
首先,我几乎被冒犯了,为什么你会认为美国键盘是“正常”的键盘?它没有任何我每天需要使用的重音字母!撇开笑话不谈(是的,在我的美国格式键盘上输入此内容),您所问的问题是错误且无关紧要的。原因如下:
"
字符不在同一个按钮2
上,您不必担心。这是最终用户的选择,最终用户确切地知道按哪个键可以获得任何结果您将 Shift+"2" 解释为"
是对他没有帮助,因为这就是它在美国键盘上的含义!他会问为什么他在你的应用程序上输入"
并得到[
?我想说的是你的应用程序不可能与本机不兼容它工作得很好,只是不知道要按什么按钮 - 但最终用户知道,因为他同时拥有计算机和键盘。
First of all I'm almost offended, why would you think the Unitated States Keyboard is the "normal" one? It doesn't have ANY of the accented letters that I need to use every day! Joke aside (and yeah, typing this on my US format keyboard), what you're asking is wrong and irrelevant. Here's why:
"
character is not on the same button2
shouldn't concern you. It's the final users choice, and the final users knows exactly what key to press to get whatever symbol. You wound not be doing him a service by interpreting the Shift+"2" as a"
just because that's what it means on the US keyboard! He would ask why is he typing the"
and getting a[
on your application?What I'm trying to say is that your application can't possibly be incompatible with native keyboards. It works just fine, you just don't know what buttons to press - but the end user knows, since he owns both the computer and the keyboard.