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!
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.
精彩评论