我的 delphi 应用程序与本机键盘不兼容。我应该怎么办?

发布于 2024-09-08 06:40:17 字数 512 浏览 3 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

扶醉桌前 2024-09-15 06:40:17

发送到 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

染柒℉ 2024-09-15 06:40:17

您在应用程序中的哪里接收键盘事件?

如果您使用 OnKeyPress 事件,

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);

您将收到“@”键:即转换由 Windows 完成。

如果您使用 OnKeyDown 事件,

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);

您将收到虚拟键代码,即原始键代码,并且您必须使用 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

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);

you will receive the key as '@': i.e. the conversion is done by Windows.

If you use a OnKeyDown event, like

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);

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.

无所的.畏惧 2024-09-15 06:40:17

首先,我几乎被冒犯了,为什么你会认为美国键盘是“正常”的键盘?它没有任何我每天需要使用的重音字母!撇开笑话不谈(是的,在我的美国格式键盘上输入此内容),您所问的问题是错误且无关紧要的。原因如下:

  • 键盘按钮上打印的文本与用户按下按钮时发生的内容几乎没有相似之处。键盘生成一个“扫描代码”,Windows 根据所选的键盘格式对其进行解释。我可以按 LeftALT+SHIFT 将计算机上的键盘格式从美国语旋转为罗马尼亚语。在我的家用电脑上也有法语循环。当然,我的美式键盘上没有任何重音字母(如按钮上的印刷文本),但请放心,这完全无关,因为我在打字时不会看按键:)
  • 事实" 字符不在同一个按钮 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:

  • The text printed on the buttons on the keyboard bares little resemblance to what happens when the user presses the button. The keyboards generates a "scan code" that's interpreted by Windows according to the selected keyboard format. I can hit LeftALT+SHIFT to rotate the keyboard format from US to Romanian on my computer. On my home computer there's also French in the rotation. Sure, I don't have any of the accented letters on my US keyboard (as in printed text on the buttons), but rest assured, it's totally irrelevant since I don't look at the keys while typing any way :)
  • The fact that the " character is not on the same button 2 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文