bindKeyToCommand

bindKeyToCommand(keycode: Integer;
                 command: Integer);

The bindKeyToCommand method of the JadeTextEdit class enables you to associate the key combination specified in the keycode parameter to the action specified in the command parameter, which can include one of the JadeTextEdit class constants listed in the following table.

SCI_BACKTAB SCI_FINDAGAIN

SCI_FINDNEXT

SCI_FINDPREV
SCI_GONEXT_JADE_BRKPNT

SCI_GONEXT_JADE_LINEMARK

SCI_GOPRIOR_JADE_BRKPNT SCI_GOPRIOR_JADE_LINEMARK

SCI_TOGGLEFOLDERHERE

SCI_TOGGLE_JADE_BREAKPOINT
SCI_TAB

SCI_TOGGLE_JADE_DEBUG

SCI_TOGGLE_JADE_LINEMARK SCI_ZOOMIN

SCI_ZOOMOUT

 

See http://scintilla.sourceforge.net/ScintillaDoc.html, for details about additional commands that are available in Scintilla.

The bound key action has the highest priority when the JadeTextEdit control has focus. Bound key actions override menu accelerator and menu shortcut event methods.

Although you can use the keycode parameter to specify any key combination, you can also use the JADE global constants in the KeyCharacterCodes category; for example, J_key_F2 or J_key_F12.

In addition, you can use the JadeTextEdit class KEYMOD_ALT, KEYMOD_CTRL, and KEYMOD_SHIFT constants. For example, J_key_F1 + KEYMOD_SHIFT + KEYMOD_CTRL indicates the Ctrl+Shift+F1 key combination.

The code fragment in the following example shows the use of the bindKeyToCommand method.

// Toggle folding
jte.bindKeyToCommand('R'.Integer + JadeTextEdit.KEYMOD_CTRL,
          JadeTextEdit.SCI_TOGGLEFOLDHERE);
// Find next/previous
jte.bindKeyToCommand(J_key_F4, SCI_FINDNEXT);
jte.bindKeyToCommand(J_key_F4 + JadeTextEdit.KEYMOD_SHIFT, SCI_FINDPREV);
// Toggle and go to linemark
jte.setLinemarkAttributes(JadeTextEdit.MARKER_JAD_LINEMARK, 0,
          jteSource.rgb(255,180,180), jteSource.rgb(128,255,255));
jte.bindKeyToCommand(J_key_F2 + JadeTextEdit.KEYMOD_CTRL,
          JadeTextEdit.SCI_TOGGLE_JADE_LINEMARK);
jte.bindKeyToCommand(J_key_F2, JadeTextEdit.SCI_GONEXT_JADE_LINEMARK);
jte.bindKeyToCommand(J_key_F2 + JadeTextEdit.KEYMOD_SHIFT,
          JadeTextEdit.SCI_GOPRIOR_JADE_LINEMARK);