Wx3270/Help/Settings/Keyboard

From The x3270 Wiki
< Wx3270‎ | Help‎ | Settings
wx3270 keyboard mapping

This tab allows the wx3270 keyboard map to be edited.

Concepts

A keyboard map (keymap) maps pressing a key or keys on the keyboard onto a series of actions to execute. The default keyboard map defines common 3270 terminal operations, such as mapping the F1 key to the action PF(1) and the Tab key to the Tab() action. You can override these mappings with your own.

Modifiers and precedence

Keyboards include modifier keys, such as Shift, Ctrl and Alt. These keys are held down to change the behavior of some other key, e.g., pressing Ctrl and A can have a different effect than pressing A alone.

A mapping will match if all of the modifier keys it specifies are pressed, but other modifier keys may be pressed as well. If a key matches multiple mappings, wx3270 will always match a more-specific mapping in preference to a less-specific one. For example, if there is a mapping for Ctrl-A and a mapping for A with no modifiers, then pressing Ctrl-A will match the first mapping, as will pressing Ctrl-Alt-A. However, pressing Shift-A will match the second mapping (because Ctrl is not pressed).

Soft modifiers

wx3270 also supports soft modifiers, which are software-defined modes that behave like modifiers, similar to Shift Lock and Num Lock on the real keyboard. The soft modifiers are:

3270 mode
The emulator is in 3270 mode.
NVT mode
The emulator is in NVT mode.
APL mode
The emulator is in APL mode.

Chords

A chord is a two-key sequence. Pressing and releasing the first key starts the cord. Pressing and releasing the second key completes the chord and executes the associated actions. (Each of the two 'keys' can actually be a key plus modifiers.)

When the first key of a chord is pressed and released, wx3270 will wait for the second key, with an indication in the operator information area, until a timeout expires.

Key codes and scan codes

When a key is pressed on a Windows keyboard, an event with two attributes is generated. Those attributes are a key code and a scan code.

A key code is generally a symbolic name for the label on the key. For example, the key just to the right of the Tab key on an English-language keyboard is labeled Q, and the key code it generates is Q. On a French-language keyboard, this same key is labeled A, and the key code it generates is A. This mapping is controlled by the currently-selected Windows keyboard, which can be changed with the Win-Space key.

By contrast, a scan code is a hexadecimal value that represents a physical key. A scan code does not change with the Windows keyboard; it always represents the same location. For example, the English-language Q key / French-language A key has the scan code 0x10.

A wx3270 keymap entry can match on either a key code or a scan code. Which to use depends on the purpose of the entry. For example, the default keymap maps Alt-A to the Attn() action (the 3270 ATTN key). A is a mnemonic for ATTN, so it makes sense to map it to the A key code, wherever that key might be. By contrast, the APL mapping for that key is the ? (roll) symbol, which is generally in that location regardless of which letter that key normally generates. So the default APL key mappings are based on scan codes. If a pressed key matches both a scan code entry and a key code entry, wx3270 will prefer the scan code entry.

Steps

1. Select a chord

If a chord (first key in a sequence) has already been defined, you can define actions for a second key in the sequence by selecting the name of the key in the combo box.

To define an ordinary mapping, leave the combo box selection at None.

To define a new chord, leave the selection at None and see step 5 below.

2. Select a key

Click on the keyboard icon. A key selection window will pop up, allowing you to specify the key and modifiers to map.

3. Select modifiers

These checkboxes allow the modifiers to be selected.

Shift
The left or right Shift key.
Alt
The Alt key. On keyboards with an AltGr key, this is only the left Alt key. On other keyboards, this can be either Alt key.
Ctrl
The left or right Ctrl key.
APL
Apply the mapping only when in APL mode.
NVT only
Apply the mapping only when in NVT mode.
3270 only
Apply the mapping only when in 3270 mode.

Note that it is also possible to map any of the physical modifier keys by itself -- pressing and releasing it without pressing another key.

4. Select match type

Key code
Match the key code (location may vary with the Windows keyboard in effect).
Scan code
Match the physical location of the key.

5. Select behavior

This is where chords are created. Selecting Perform actions makes this a single-key mapping (or the second key of a chord). Selecting Start chord defines this key as the first key of a two-key chord. It can then be used in step 1 to define the second-key mappings.

6. Define actions

Displays the actions associated with the key, plus information about how the mapping was matched.

If the actions box is blank, then there is no mapping for the key. Pressing it will have no effect. You can click on the New button to create a mapping for it.

If the actions box is not blank, and there is no label under it, then the key exactly matches a mapping. You can click on the actions box or on the Edit button to change the associated actions, or click on the Delete key to remove the mapping.

If the label under the actions box says uses default input rule, then there is no explicit mapping for the selected key, but pressing it will will cause its key code to be entered as input. You can click on the New button to create a mapping for it.

If the actions box says Wait for second key, then the selected key is the start of a chord. You can click on the Delete button to remove the chord definition.

If there is a label under the actions box saying inherited from, then there is no exactly-matching mapping for the selected key; the actions are inherited from a less-specific mapping (a mapping that specifies fewer modifiers than the selected key). You can click on the New button to create a more-specific mapping for the selected key.

Bottom buttons

➕ New
Creates a new key mapping, using the macro editor.
🖉 Edit
Edits an existing key mapping, using the macro editor.
❌ Delete
Deletes the actions or chord associated with the key.

See also

wx3270/Help/Settings