CTRL key as hotkey

BlitzPlus Forums/BlitzPlus Programming/CTRL key as hotkey

Cold Harbour(Posted 2004) [#1]
Any way to set the Left CTRL key up as a hotkey? I know the CTRL key is maybe a special key but it still has a scancode, so shouldn't it work?

Basically my app needs to know when CTRL is being pressed so that a user can pick multiple things at once from a custom picker gadget - pretty standard in Windows apps.

Well I use a standard $101 check but this fails when a button or something is activated.
So I change focus back to the main Window when a button is pressed and that is a sort of solution but is 1) Clunky and dumb, 2) looses the button activated feature in Windows and so my app looks and behaves less like the user will expect.

So I use a hotkey event and find you can't seem to assign CTRL. Even tried things like Hotkeyevent 29,2, etc but no luck.

Any ideas? Thanks a lot.


Wiebo(Posted 2004) [#2]
afaik this is not possible, but you could check for a keydown event and set a ctrldown flag in your app, so the ctrl state is kept when you press another gadget... You can clear that flag when you encounter a keyrelease event.


Cold Harbour(Posted 2004) [#3]
Thanks for the reply Wiebo. Keydown() and $101 events get processed by the activated gadget so that won't work unless the main window is the active gadget.

The kludge is to refocus after a 401 event but this isn't foolproof - pressing a button and moving the mouse away before mouse up will activate the gadget but not trigger an event.


Wiebo(Posted 2004) [#4]
global hotkeys as you suggest are not possible natively in b+. Maybe someone can think up a userlib or something. Don't look at me for that though =]