Using Keyboard Shortcuts

To call an editor extension function you must create event subroutines with names that identify the keyboard shortcuts they must respond to. These keyboard subs have the fixed names Gfa_Ex_?, Gfa_App_? or Gfa_App_S?, where ? is a placeholder for one of the characters A-Z and the numbers 0-9. Thus, when you want to create an extension procedure that is invoked after pressing the combination Shift+Ctrl+X, the subroutine should be named Gfa_Ex_X.

 

Sub Gfa_Ex_X    ' Shift+Ctrl+X key event

' Todo: your extension code

EndSub

Combinations with the application key are allowed as well. For App+X the sub Gfa_App_X is called. The App key is the Windows application key (Application key), which sits next to the right Windows Start key. Often this key is used to display a context menu, which might also be a good purpose for an editor extension.

Example: Insert Date and Time

 

Sub Gfa_App_D   ' App+D - popup to insert Date & Time

Dim i% = PopUp(" Date| Time| DateTime")

Gfa_Insert Choose(i% + 1, Date$, Time$, Now$)

EndSub

There are also some function keys available for shortcut assignment: F2, F8, F9, and in shifted states for F11 and F12.

Shift keys Subs
None Gfa_F2, Gfa_F8, Gfa_F9
Shift Gfa_SF2, Gfa_SF8, Gfa_SF9, Gfa_SF11, Gfa_SF12
Ctrl Gfa_CF2, Gfa_CF8, Gfa_CF9, Gfa_CF11, Gfa_CF12
Shift + Ctrl Gfa_SCF2, Gfa_SCF8, Gfa_SCF9, Gfa_SCF11, Gfa_SCF12
Alt Gfa_AF2, Gfa_AF8, Gfa_AF9, Gfa_AF11, Gfa_AF12
Shift + Alt Gfa_SAF2, Gfa_SAF8, Gfa_SAF9, Gfa_SAF11, Gfa_SAF12
Ctrl + Alt Gfa_CAF2, Gfa_CAF8, Gfa_CAF9, Gfa_CAF11, Gfa_CAF12
Shift + Ctrl + Alt Gfa_SCAF2, Gfa_SCAF8, Gfa_SCAF9, Gfa_SCAF11, Gfa_SCAF12

Note: S = Shift, C = Ctrl, A = Alt, SCA = Shift + Ctrl + Alt

Example: 

 

Sub Gfa_CF2             ' Ctrl+F2 - New

Gfa_New

End Sub

Using The Extra Menu

{Created by Sjouke Hamstra; Last updated: 25/10/2014 by James Gaite}