Key Up Event
Hi Friends,
i would like to create a hotbar like in Maya: If you hold Space pressed it appears and disappears immediately if you release the key. To start the script by pressing a key is easy: just assign a hotkey to it.
BUT how i can check during the script is running, about the state of a key? I need an event handler like "on key up ...".
thanks!
Comments
Well it would probably be
Well it would probably be easier to instead of having to keep the key pressed, to have it appear the first time it's pressed and have it disappear the second. If you really need it to work only when it's pressed, then you can probably do something with dotNET. Maybe the System.Windows.Input class would help.
There no such event handler
There no such event handler like "on key up ...", so you'll need some fake trick. Currently you can track only 4 keyboard keys for their state:
i.e. for example copy the next snippet to new script and evaluate all by Cltr+E
so, just before you losing time in experiments with callbacks, just read what I'll do in this case, and that will be pass the key tracking in timer (rollout controller). So, there is first pass solving:
I say 1st pass because there's a discomfort, CTRL key must be pressed and if you run this via installed macroScript and if to say you assign key "H", then holding CTRL will be accepted as Ctrl+H and if this is a valid shortcut, you know, it will run instead. So in 2nd bypass I'll add another timer which to delay a few secs (2 for example) and then activate the main closing timer. This way you can press and hold CTRL key after rollout opened, and as in the 1 pass - it will stay open until you release control key:
I hope this help!
my recent MAXScripts RSS (archive here)