Keyboard map files can be created by defining an XML file that maps the relationship between a key and a function. Any key may be mapped to any of the supported functions. If a key is not mapped then the key event is passed to the browser.

Keyboard map files must be created in the <prod-dir>/ts directory.

Mappable Keys

Shift, Ctrl, and Alt key combinations can be mapped by prefixing the base key name with the combination key using a plus (+) sign to separate them. For example, to map the Shift-Tab key combination, use the “Shift+Tab” definition.

If more than one shift modifier key is used you must ensure they are specified in the correct order; Shift, followed by Ctrl, followed by Alt. The key names are also case sensitive.

The shift modifier keys may be mapped individually, so the Ctrl key could be mapped to the PostData function. This sort of mapping applies to the individual key only so Ctrl+C would still copy data to the clipboard.

Any printable character can be mapped to a supported function but alphabetic keys must be entered in uppercase. Thus, to map ‘r’ use “R”; to map ‘R’ use “Shift+R”.

You can also specify the hexadecimal code of the virtual key. Thus, 0xBF maps to the ‘/’ forward-slash key.

Base Key Name

Key Description

LeftMouseButton

Left mouse button

RightMouseButton

Right mouse button

MiddleMouseButton

Middle mouse button (on a 3-button mouse)

DownArrow

Down arrow key

LeftArrow

Left arrow key

RightArrow

Right arrow key

UpArrow

Up arrow key

Alt

Alt key

Note: It is not possible to distinguish between the left and right Alt keys

Backspace

Backspace key

Cancel

Cancel key

Clear

Clear key

Ctrl

Control state key

Note: It is not possible to distinguish between the left and right Ctrl keys

Del

Delete key

End

End key

Enter

Enter key

Note: It is not possible to distinguish between Enter and the numeric keypad Enter

Esc

Escape key

F1

Function key 1

F2

Function key 2

F3

Function key 3

F4

Function key 4

F5

Function key 5

F6

Function key 6

F7

Function key 7

F8

Function key 8

F9

Function key 9

F10

Function key 10

F11

Function key 11

F12

Function key 12

Home

Home key

Ins

Insert key

PageDown

Page down key

PageUp

Page up key

Pause

Pause key

Shift

Shift state key

Note: It is not possible to distinguish between the left and right shift keys

Space

Spacebar

Tab

Tab key

LeftWindows

Left “Windows” key

RightWindows

Right “Windows” key

Apps

Applications key (next to the right “Windows” key)

ScrollLock

Scroll lock key

NumLock

Numeric lock key

NumPlus

Numeric keypad plus key

NumMinus

Numeric keypad minus key

Decimal

Numeric keypad decimal point key

Add

Numeric keypad addition key (synonym for NumPlus)

Divide

Numeric keypad division key (synonym for NumMinus)

Multiply

Numeric keypad multiplication key

Subtract

Numeric keypad subtraction key

All printable characters

A-Z, 0-9, etc.

There is no difference between the left and right Cntrl, Alt, or Shift keys, nor between the Enter key and numeric keypad Enter. aXes Terminal Server relies upon the virtual key codes sent by the browser. The Microsoft MSDN website includes the list of virtual key codes.

Key Functions

Key functions are case sensitive.

Key Function

Function Description

Attention

Run the Attention key operation.

BackSpace

Runs the backspace operation but ignores it if the cursor is not in an input-capable field.

ClearField

Clear the contents of the current field.

ClearScreen

Clear the contents of the screen.

Duplicate

Run the Duplicate operation.

Enter

Run the Enter operation.

EraseEOF

Clears the field from the current cursor position to the end.

EraseInput

Clears all modified fields and moves the cursor to the first input-capable field.

FieldExit

Run Field Exit operation.

FieldMinus

Run Field- operation.

FieldPlus

Run Field+ operation.

ForwardEdgeTriggerAutoEnter

Run the Forward Edge Trigger Auto Enter operation.

Function

Run a function key (F1 to F12).

Help

Run the Help operation.

Home

Move to the home position.

InsertDecimal

Insert the decimal separator when pressing the decimal point in the numeric pad keyboard, regardless of whether aXes is currently in OVERWRITE or INSERT mode.

To overwrite a character, use the PutDecimal command.

Applies to aXes-TS and aXes-TS2 except OVERWRITE or  INSERT mode

InsertUnicodeChar

Insert a Unicode character, regardless of whether aXes is currently in OVERWRITE or INSERT mode.To overwrite a character, use the PutUnicodeChar command.

Applies to aXes-TS and aXes-TS2 except OVERWRITE or INSERT mode.

InsertYen

Insert a Yen symbol, regardless of whether aXes is currently in OVERWRITE or INSERT mode.

To overwrite a character, use the PutYen command.

Applies only to aXes-TS.

MoveDown

Move the cursor.

Applies only to aXes-TS.

MoveLeft

Move the cursor.

Applies only to aXes-TS.

MoveRight

Move the cursor.

Applies only to aXes-TS.

MoveUp

Move the cursor.

Applies only to aXes-TS.

NewLine

Run the New Line operation.

NextField

Move to the next field.

Noop

No operation. Trap and ignore unwanted key press events.

PutDecimal

Insert the decimal separator when pressing the decimal point in the numeric pad keyboard, overwriting existing one if in OVERWRITE mode.

Applies only to aXes-TS.

PutUnicodeChar

Insert a Unicode character, overwriting existing one if in OVERWRITE mode.

Applies only to aXes-TS.

PutYen

Insert a Yen symbol, overwriting existing one if in OVERWRITE mode.

Applies only to aXes-TS.

PA1

Program Attention key 1.

PA2

Program Attention key 2.

PA3

Program Attention key 3.

PostData

Send the current form (screen) to the server.

PrevField

Move to the previous field.

Print

Run the Host Print operation.

RecordBackspace

Run the Record Backspace operation.

Refresh

Redraw the current panel.

RollDown

Run the RollDown operation

RollLeft

Run the RollLeft operation

RollRight

Run the RollRight operation

RollUp

Run the RollUp operation

ShiftFunction

Run a function key (F13 to F24).

SLPAutoEnter

Run the Select Light Pen Auto Enter operation.

SystemRequest

Run System Request operation.

ToggleSelect

Toggle a selection item (such as a radio button or check box) on or off.

 XML File Format

The XML keyboard mapping file must have one <KEYMAP></KEYMAP> block that contains all the key maps. Each key map must be enclosed in a <MAP></MAP> block.

The syntax of the XML file is:

<?xml version=“1.0” encoding=“utf-8” ?>

<KEYMAP> 

   <TITLE>Textual title</TITLE>

    <DESCRIPTION>Text description</DESCRIPTION>

    <MAP>

        <KEY>Key name</KEY>

        <COMMAND>Key function</COMMAND>

        <PARAMETER name=“charCode”>Unicode character</PARAMETER>

        <DESC>Text description</DESC>

    </MAP>

    <MAP type=“Range”>

        <START_KEY>First key in range</START_KEY>

        <END_KEY>Last key in range</END_KEY>

        <COMMAND>Key function</COMMAND>

        <DESC>Text description</DESC>

    </MAP>

</KEYMAP>

Each <KEY></KEY> block must contain a key name from the Mappable Keys table listed above or a virtual key code. Virtual key codes can be found in the MSDN library.

The value in each <COMMAND></COMMAND> pair must be one of the values found in the Key Functions table listed above.

The only type of parameter supported on the <PARAMETER></PAREMETER> pair is “charCode”. The value must be a valid Unicode character. The value may be specified in decimal, octal (0nn), or hexadecimal (0xnn) notation).

Two types of key mapping are supported:

  • Single key mapping
  • Key range mapping

Single Key Maps

A single map simply maps one specific key, or key combination, to one function. For example, the following definition maps the “Enter” key to the “PostData” function.

<MAP>

    <KEY>Enter</KEY>

    <COMMAND>PostData</COMMAND>

    <DESC>Send the form to the server</DESC>

</MAP>

Key Range Maps

Range maps allow a range of keys to be mapped. The range is determined by the virtual key code of the key pressed.

You must provide a start and end key. The range includes the start and end key.

<MAP type=”Range”>

    <KEY_START>LeftArrow</KEY_START>

    <KEY_END>DownArrow</KEY_END>

    <COMMAND>Move</COMMAND>

</MAP>

The following example maps the arrow key range to the “Move” function. The arrow keys have the virtual key codes:

  • LeftArrow    X’25’
  • RightArrow    X’27’
  • UpArrow    X’26’
  • DownArrow    X’28’

So to include all arrow keys in the range the left and down arrows define the range bounds.

Single key maps take precedence over range maps so it is possible to map a range and then override a single key within the range. For example, the F1 to F12 keys could be mapped as a range and the F3 key could be mapped to something else.

Making a New Keyboard Map Available

In aXes-TS, once you have defined a keyboard map file you can make it available by editing the ts_keymaps.html file (found in the <prod-dir>/ts/skins directory) and add the name of the new keyboard map file to the list of available keyboard maps. You can also change the keyboard map that is selected by default.

In aXes-TS2 you simply make sure the file name conforms to the format xxxxkeymap.xml and place it in your /ts/ directory. TS2 will find it and add it to the keymaps menu. If you want the menu to show text other than the file name, create a translation for it in Texts_Cust_xx.txt, for example: "mycustomkeymap.xml": "Custom Keymap",

Changing the Default Keyboard Map

The default keyboard map is windowskeymap.xml. In aXes-TS you can change this to any defined keyboard map by editing the ts_frame.html file (found in the <prod-dir>/ts/skins directory) and replace the line:

var key_map = “windowskeymap.xml”

with the name of the preferred keyboard map file. For example:

var key_map = “as400keymap.xml”

You should also copy the new default keyboard map and replace the DefaultKeyMap.xml file. This file is used when no keyboard map files can be found.

In TS2 you cannot set the default (except by replacing the defaultkeymap.xml file). However, end-users can change the default themselves because TS2 remembers the last used keymap.

Mapping the Decimal Point Numeric Pad Key

If you are in a country where the decimal separator is not the decimal point and you want the decimal point in the numeric key pad to reflect this, add the following block to the keyboard map file:

<MAP>

    <KEY>0x6E</KEY>

    <DESC >Num Pad decimal point</DESC>

    <COMMAND>InsertDecimal</COMMAND>

</MAP>

Mapping the Yen Symbol

The Yen symbol is mapped to x’5c’ in Shift-JIS code page, which is also the code point used for the backslash in other code pages. This makes it difficult to correctly determine whether the user wanted a Yen or a backslash. Keyboard mapping can be used to correct this difficulty.

Depending on the type of keyboard in use the keyboard mapping may need to be different. The following examples use a standard US keyboard and physical location of keys will be different in various geographies and will vary even in Japan depending on keyboard type and physical layout of engraved keys, but the codes issued to the operating system do not change.

To map the InsertYen function to "/" (Forward slash), add the following block to the keyboard map file:

<MAP>

    <KEY>0xBF</KEY>

    <DESC >Insert Yen </DESC>

    <COMMAND>InsertYen</COMMAND>

</MAP>

To map the InsertYen function to "\" (Backslash), add the following block to the keyboard map file:

<MAP>

    <KEY>0xDC</KEY>

    <DESC >Insert Yen</DESC>

    <COMMAND>InsertYen</COMMAND>

</MAP>

Only insert one of the above at a time in the keyboard map XML definitions.