benhoyt:
--------------------------------------------------------------------------------
Just thought of one possible implementation that might fit in with the existing
PSPad scripting: make a function CtrlQHandler (activated with shortcut Ctrl-Q)
that waited for the next keystroke and handled it according to whatever it was:

function CtrlQHandler() {
  var key;
  key = pspad.getNextKeyStroke();
  if (key == "Ctrl-R")
    command("ecEditorTop");
  else if (key == "Ctrl-C")
    command("ecEditorBottom");
  ...
}


Problem is, I don't think something like getNextKeyStroke() exists.
Just a thought...

-Ben
--------------------------------------------------------------------------------


It would be easier if you had a timer function:


var tmrId = null;
var gotQ = false;

function CtrlQHandler() {
  gotQ = true;
  tmrId = setTimeout(150, function() { gotQ = false; });
}

function CtrlRHandler() {
  if (gotQ) {
    // Eat message
    command("ecEditorTop");
  }
  else {
    // Handle message normally
  }
}

function CtrlCHandler() {
  if (gotQ) {
    // Eat message
    command("ecEditorBottom");
  }
  else {
    // Handle message normally
  }
}


Jan, please give us setTimeout and setInterval functions!

-- 
<http://forum.pspad.com/read.php?2,42511,42517>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem