bindKeyToNotification

bindKeyToNotification(keycode:  Integer;
                      eventTag: Integer);

The bindKeyToNotification method of the JadeTextEdit class assigns the key combination specified in the keycode parameter to the notification message specified in the eventTag parameter. When the key combination is pressed, the notification is generated and a user notification occurs; that is, the userNotify event is called. (For details about receiving notifications, see "Receiving User Notifications", in Chapter 2 of the Developer's Reference.)

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_F3 + KEYMOD_SHIFT + KEYMOD_CTRL indicates the Ctrl+Shift+F3 key combination.

The eventTag parameter is a user-defined integer value (for example, an index into an array) that identifies a notification subscription that is passed to the notification callback method. The notification is the JadeTextEdit class EVENTTYPE_BOUNDKEY constant.

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

// Breakpoint linemark
jteSource.bindKeyToNotification(J_key_1 + JadeTextEdit.KEYMOD_CTRL, 1001);

The method in the following example shows a userNotify event for a bound key notification.

handleUserNotify(textedit:  JadeTextEdit input;
                 eventType: Integer;
                 theObject: Object;
                 eventTag:  Integer;
                 userInfo:  Any);
vars
begin
    if eventType = JadeTextEdit.EVENTTYPE_BOUNDKEY then
        if eventTag = 1001 then // Ctrl+1
            self.doCtrl_1();
        endif;
    endif;
end;