B. Defining Function and Control Keys : Key Mapping Overview (UNIX and VMS Environments) : Mapping File Example (UNIX and VMS)
 
Share this page                  
Mapping File Example (UNIX and VMS)
The following example of a mapping file illustrates the full range of statements available to specify any sort of mapping:
/* This is an example of a mapping file */
menuitem2 = pf3 (Key 3)
menuitem3 = controlE (^E)
frskey7 = pf8
previousfield = controlP
nextfield = rightarrow
rubout = controlDEL
controlA = off
/* this turns control‑A off */
pf7 = off
The first line in the mapping file sample is a comment. Comments can appear anywhere in a mapping file. Their purpose is to provide information to someone looking at the file; they are ignored by the FRS.
The next five lines are examples of mapping statements. All mapping statements follow the same basic syntax. To the left of the equal sign is a mapping object, which specifies the operation or function to which the key is being mapped. To the right of the equal sign is the internal designation for the function, control, or arrow key that maps to, and activates, the mapping object. For instance, the following statement specifies that the second item on each menu line (menuitem2) maps to program function key pf3:
menuitem2 = pf3 (Key 3)
This mapping statement contains a label within parentheses to the right of the internal program function key. The specified label appears next to the second menu item on the user's screen to indicate what key to press to activate the menu selection (in this case, key 3). The label also appears in the Help Keys operation display. If no label is specified in the mapping statement, an appropriate default label is displayed on the menu line and in the Help Keys display. If you specify the label explicitly, it must indicate the physical key on the keyboard that generates the correct escape sequence, as defined in the termcap file, for the specified program function key, control key, or arrow key.
The following statement enables the user to move the cursor to the previous field on a form by pressing Control‑P:
previousfield = controlP
This mapping statement does not contain a label.
The last two statements in the example are known as disabling statements. A disabling statement is used to disable a function, control, or arrow key. For example, the following statement turns off the key mapped to the pf7 program function key:
pf7 = off
This means that the key has no effect in a forms program governed by this map file, and merely beeps when pressed.