Function keys

You can assign scripts to function keys (F1-F35) and use them for working in module Vision. Thereby, the control script keypressed.ctl, which must be located in the directory ../scripts, is started. The following parameters are passed to the main()-function:

Syntax

main(int key, int mod)
{
  /* the key assignments and their actions are defined 
  here */
}

Parameters

Parameter Description
key Function key (KEY_F1 - KEY_F35)
mod modifier (KEY_CONTROL, KEY_ALT, KEY_SHIFT, KEY_META )

Description

You have to write a script containing the required key assignments. The script must be saved in <proj_path>/scriptswith the namekeypressed.ctl. If a VISION module is running and you press the assigned function keys this function is called.

If no keys are specified and the keypressed.ctl does not exist, Windows default actions are called (for example, the key combination <ALT> <F6> minimizes the current Vision window).

For <ALT> <F4> a key event is not returned, thus, this key assignment cannot be overwritten with the keypressed.ctl script. To prevent the closing of a panel, an empty script (e.g. only one line with ";") has to be defined in the closeEvent.

Example

If the function keys F1 and Shift are pressed at the same time, the module name (of the open module) and the numbers of function keys are printed.

main(int key, int mod)
{
  string s;
  if( (key==KEY_F1)
  && (mod==KEY_SHIFT) )
  {
    s=myModuleName();
    DebugN(key, mod);
    DebugN(s);
  }
}

The modifier keys can also be pressed at the same time. The single modifier keys can be queried as follows:

If the modifier keys F1, ALT and Shift are pressed at the same time, the module name (of the open module) and the numbers of the function keys are printed.

main(int key, int mod)
{
  string s;
  if ( (mod & KEY_ALT) && (mod & KEY_SHIFT)&& (key == KEY_F1))
  {
    s=myModuleName();
    DebugN(key, mod);
    DebugN(s);
  }
}