benhoyt:
--------------------------------------------------------------------------------
With a getKeyStroke() type method, you only need code for multi-key
handlers -- you can use PSPad's existing KeyMap.ini for the single key
mappings.
--------------------------------------------------------------------------------
Unfortunately a getKeyStroke()-type method would have to run
synchronously - which means either freezing up the entire scripting system while
waiting for the user to press a key, or creating a separate thread for each
running script (Don't go there!). So yes, it would be easier, but it's a bit
like a doWhatIMean() function :-)
What would be really nice is to be able to tap into PSPad's event system in a
similar manner to the DOM:
PSPad.addEventListener('keypress', handleKeyPress, false);
function handleKeyPress(e) {
if (e.keyCode == 13) {
// Do something
e.preventDefault();
}
}
Then you could easily set up a central script for handling multiple keystroke
shortcuts, and allow other scripts to register with it.
But I don't think that's going to happen any time soon! It would be quite a
dramatic change to the way the scripting system works. We can only hope! :-)
--
<http://forum.pspad.com/read.php?2,42511,42528>
PSPad freeware editor http://www.pspad.com