Keyboard Actions

JS9 supports the actions that get executed in response to (case-sensitive) keypress events. The following actions are defined in the JS9.globalOpts.keyboardActions array:

You can view the current mapping between keys and actions using this Keyboard plugin. Also, you can execute individual actions by clicking the 'key' buttons. This is especially useful for devices without keyboards, such as iPads and iPhones.

It is possible to add new actions. To do this, first add an entry to the JS9.Keyboard.Actions object. The property name for the new entry should be descriptive text, like that which is found in JS9.globalOpts.keyboardActions. The property value will be a function having the calling sequence:

  function(im, ipos, evt)
where: For example:
  JS9.Keyboard.Actions["export image as a PNG file"] = function(im, ipos, evt){
    .... action implementation goes here ...
  };
Once this new action property has been defined, you can map it to a keypress event in JS9.globalOpts.keyboardActions:
  JS9.globalOpts.keyboardActions["x"] = "export image as a PNG file";
The new action will be shown in the Keyboard plugin display, and will be executed any time the "x" key is pressed.