Function Keys
Until now, all of the string fields described sequences to be sent to the terminal from the application. The fields that follow do just the opposite. These fields describe special sequences that will be sent from the terminal to the application when certain keys on the keyboard are pressed.
Most terminals have a set of generic keys called "function keys." These keys are typically labeled as "F1", "F2", "F3", and so on. Also, there are frequently "arrow keys," with arrows pointing up, down, left, and right. There is no ASCII standard for the codes sent by these keys. In fact, it is not unusual for these keys to send a sequence of characters as opposed to a single character. Any application program using these extra keys must recognize when one of these keys has been pressed.
The termcap fields k1..k0 can describe up to 10 function keys. To complete these fields, the terminal manual must be used to determine what sequences are sent by the function keys. Because function keys can be changed by the user; therefore, the manual may not always be correct.
Additionally, applications differ in the interpretation of the :k0=: field. Some consider :k0=: to define the first function key even if it is labeled "F1" as opposed to "F0". Others consider :k0=: to define the tenth function key. PRO/5 uses :k1=: as the first function key, and :k0=: as the tenth.
In the Wyse 60 manual, the first function key (labeled F1) sends "^A @ CR". When pressed, the function key sends an ^A character, an "@", and a carriage return character to the application program. In termcap this would be expressed as :k0=^A@\r:
There are also some fields l1..l0 (these are lower case "L"'s.) that correspond to fields k1..k0. These are string fields that describe the actual labels of the function keys on the keyboard. For example, an application that prompts the user to press the function key corresponding to :k5=: would examine the :l5=: field to determine what to call the key. If no such field was given, the application program would assume the key was labeled F5 or F6.
There is a numeric field, :kn#:, that tells how many function keys are present on the keyboard. However, this field is becoming obsolete.
The following fields describe the arrow keys:
Field |
Description |
kl= |
Sequence sent by the left arrow key. Sometimes the left arrow key sends a backspace character (as on the Wyse 60). This can cause problems since the left arrow key and the backspace key are usually distinct on the keyboard but the application could not tell them apart. The Wyse 60 uses :kl=^H: |
kr= |
Sequence sent by the right arrow key. The Wyse 60 uses :kr=^L: |
ku= |
Sequence sent by the up arrow key. The Wyse 60 uses :ku=^K: |
kd= |
Sequence sent by the down arrow key. The Wyse 60 uses :kd=\n: |