奇怪的热键行为 - 它不允许连续使用相同的热键
THotkey 不允许相同的热键两次是正常行为吗?
这就是我的意思。
假设我将热键设置为 Ctrl+Shift+X。然后我做其他事情,然后回来改变它。当我按住 Ctrl 和 Shift 时,我意识到我无论如何都不想更改热键,因此我在按住 Ctrl+Shift 的同时按 X。现在 THotkey 拒绝了它。我松开所有按键,然后再次尝试相同的组合。它仍然不允许我分配该键。即使我单击表单上的其他位置,然后返回并尝试相同的组合,它也不会让我这么做!
这是为什么?我怎样才能防止这种情况发生?
谢谢!
Is it normal behavior for a THotkey to not allow the same hotkey twice?
Here is what I mean.
Say I set the hotkey to Ctrl+Shift+X. I then do something else, and come back to change it. While I am holding down Ctrl and Shift, I realize I dont want to change the hotkey anyway, so I press X while holding Ctrl+Shift. Now the THotkey rejects it. I let go of all the keys, and try the same combination again. It still wont let me assign that key. Even if I click somewhere else on my form, and go back and try the same combination, it wont let me!
Why is that? How can I prevent that?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您的 THotKey 控件失去焦点时,您会说您在系统范围内注册了热键。当您重新进入 THotKey 控件时,原始值仍然被注册,因此当您按下该组合键时,操作系统会拦截它,因为它是已注册的组合键。 THotKey 控件永远看不到它。
当 THotKey 控件具有焦点时,您需要取消注册热键。
When your THotKey control loses focus, you say you register the hotkey system-wide. When you re-enter the THotKey control, the original value is still registered, so when you press that key combination, the OS intercepts it because it's a registered key combination. The THotKey control never sees it.
You need to unregister the hotkey while the THotKey control has focus.