Specify a function to execute on a key press.


A custom keyboard shortcut is a function or macro that executes when the specified keyboard key is pressed. By default, custom keyboard shortcuts are disabled. To enable:


setconfig("keyboard_shortcuts", 1)




setconfig("keyboard_shortcuts", 2)


A keyboard shortcut handler is an SPL function or macro where the name of the function or macro specifies the shortcut key. For example:


// Ctrl+g handler
    W0 := gnorm(1000, 1);


Now pressing the Ctrl+g assigns the formula gnorm(1000, 1) to the current Window and generates 1000 samples of random noise. Because keyboard functions result in actions, the := operator is used to assign the Window formula and set the data.


For a shortcut that mimics the Read SPL File pull down command by pressing F12:


#include <pdc.h>
// F12 handler


For more information on PDC (pull down command) macros, see pdc.h:


view pdc.h


Supported Keys


Control key presses are handled with ctrl_*_key() functions where * is a letter.


Function key presses are handled with f*_key() functions where * is a number.


Keyboard handlers are case insensitive.


Keyboard handlers result in actions, data is not returned. Use an assignment operator : (Window Assignment), := (Hot Variable Assignment) or = (Variable Assignment) to assign data to a Window or variable.


For setconfig("keyboard_shortcuts", 1), keyboard shortcuts are looked up dynamically.


For setconfig("keyboard_shortcuts", 2), keyboard shortcuts must be loaded (in memory) SPL functions or macros. This mode generally results in more responsive keyboard handling. Keyboard shortcuts can reside in dadisp.spl or dadisp.mac for automatic loading on startup.


A handler may be overridden by operating system keyboard sequences.