KEYBOARD SHORTCUTS

Purpose:

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)

 

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
ctrl_g_key()
{
    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
f12_key()
{
    pdc(PDC_SPLREAD);
}

 

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.

 

Miscellaneous

 

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.

 

A handler may be overridden by operating system keyboard sequences.