bindKeyToText

bindKeyToText(keycode:  Integer;
              text:     String);

The bindKeyToText method of the JadeTextEdit class assigns the key combination specified in the keycode parameter to the string specified in the text parameter; for example, JADE accelerator keys.

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_A.

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

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

// Bind the accelerator keys
jte.bindKeyToText('A'.Integer + JadeTextEdit.KEYMOD_SHIFT +
                  JadeTextEdit.KEYMOD_CTRL, "abortTransaction;");
jte.bindKeyToText('B'.Integer + JadeTextEdit.KEYMOD_SHIFT +
                  JadeTextEdit.KEYMOD_CTRL, "beginTransaction;");
jte.bindKeyToText('C'.Integer + JadeTextEdit.KEYMOD_SHIFT +
                  JadeTextEdit.KEYMOD_CTRL, "commitTransaction;");
jte.bindKeyToText('E'.Integer + JadeTextEdit.KEYMOD_SHIFT +
                  JadeTextEdit.KEYMOD_CTRL, "endforeach;");