Key Mapping Overview

Contents of Article


Introduction

Chords

Deciding on specific chords for your needs

Accessing Special Characters

Character Maps

Key Mapping Limitations

A cautionary note about key mapping


Introduction


The key mapping process requires locating an unassigned keyboard key, and assigning a command string to it.  You can inspect the mapping of keys individually, or you can use the KEYMAP LIST command to inspect the mapping of all defined keys.


With few exceptions, function keys, alphanumeric keys, and other keys on the keyboard are all treated and mapped in exactly the same way.


Chords


You can use nearly any key on the keyboard, and can use that key in any of 8 eight different chords.   A chord is a regular key, optionally in combination with the Shift, Control and/or Alt key.  (Sometimes, the word chord is meant when at least two of the three keys Shift, Control and Alt are pressed at the same time.)  Once you select a physical key for mapping, the definition of every chord for that key can be mapped at the same time, since all eight shift possibilities are displayed on a single screen, as shown below.


For example, the F1 key can be assigned 8 different functions, one each for the chord combinations F1, Shift-F1, Control-F1, Alt-F1, Shift-Control-F1, Shift-Alt-F1, Control-Alt-F1 and Shift-Control-Alt-F1.


What would you do with all those keys?  Well, nobody is likely to use them all, but you can use some of them for launching macros and for typing foreign letters and symbols.  For example, you could map the lower-case Spanish letter ñ to Ctrl‑N and map the upper-case Spanish letter Ñ to Ctrl‑Shift‑N.  


Deciding on specific chords for your needs


When you pick the keys to use for these purposes, the main thing is to choose something that makes sense to you, so you will remember it.  You can use any strategy you like, but time and experience have shown that some choices work better than others.  Here are some principles to consider:







In the example above, we mapped the lower-case Spanish letter ñ to Ctrl‑N and the upper-case Spanish letter Ñ to Ctrl‑Shift‑N.  Another reasonable choice would be Alt-N and Alt-Shift-N (although Alt-Shift is harder to type than Ctrl-Shift).


However, a choice like Ctrl-N and Ctrl-Alt-N could be confusing, since it's not clear which chord is used for the upper case Ñ.   We picked Ctrl-N and Ctrl-Shift-N because it retains the use of the shift key for a letter (rule 3) and because the Ctrl/Shift combination is usually the closest together and so is the easiest to type (rule 2).


Bear in mind that, on international keyboards that possess an AltGr key, they are designed to transmit the same keyboard data that would occur if you manually held down the Ctrl and Alt keys at the same time.  That means, for SPFLite purposes, the single key AltGr and the two keys Ctrl and Alt used together, mean exactly the same thing.   By default, SPFLite maps all keys with a printable value (the alpha-numeric and special character keys) so that they will function normally with the AltGr key.


Accessing Special Characters


But wait a minute!  If I don't have a certain special character mapped to any key, how will I ever get it into the key mappings I want?  


If you happen to know the decimal number of the character you want, you can enter it using ALT+0nnn.  For example, you can enter an EBCDIC ¬ not sign (X'AC') by holding down the ALT key and typing 0172, where X'AC' = decimal 172.


You have to actually enter the leading 0, or otherwise you get an OEM key value instead of an Ansi value, and for keys that are >= X'80' they won't be right.  SPFLite uses Ansi encoding, not OEM encoding, and so 172 and 0172 are not the same character.


This ALT + number technique only works in the KEYMAP GUI entry fields, not in the main SPFLite edit window.  That's because SPFLite's extensive key mapping logic would capture any special keys like ALT + a number, and Windows would never see it to convert the number to a character.  When you are within a GUI dialog, Windows itself directly manages both the screen and the keyboard input instead of SPFLite, and that's why this technique works.  However, once you have a key mapped to some special character, you can use it on the SPFLite editor screen just fine.


The easiest way to get special characters is to use a character map.


Character Maps


If you want a graphical way to do this you can bring up the Windows Character Map utility, click on the desired letter, and copy it to the clipboard.  Then come back to SPFLite and paste it into the key mapping definition you need.


SPFLite really works internally only with Ansi characters, so even though the Windows Character Map utility can select many different Unicode characters, you can only use Ansi in the key mapping.  You will see on the lower-left of this utility a Unicode hex value for each character.  As long as it shows U+00FF or lower, you can use it.


If you find that you need certain special characters in many places, including outside of SPFLite, you can select a foreign or alternative keyboard layout, or create a custom layout using a utility program such as Microsoft Keyboard Layout Creator or KbdEdit.  If you do this, you will not need to map any special characters in your layout with SPFLite's KEYMAP.  (An Internet search will find this packages.)


SPFLite now also supports its own character map.  In the Key Map display, there is a button on the lower right corner of the screen, “Show Character map”.  If you click on this button, you will see a pop-up display with a 16 by 16 grid of characters, something like this:



An advantage of this over the Windows character map, is that SPFLite uses the same font for this as is used for your edit screen; so it better reflects what you will really see for the chosen character(s).  The specific characters available and their appearance depend on the display font you have chosen; the pop-up above shows the RASTER font, available from SPFLite as a download.  


Alternate Character Sets


The character display shown by SPFLite is sensitive to the character set you have specified via the SOURCE setting.  For example, if you display the character map while working on an EBCDIC file, the display will show the EBCDIC character set, and will place appropriate characters into the clipboard based on the in-use character set.  The display shown in may be in another collating sequence (either EBCDIC or user-defined), and will report characters placed into the Clipboard based on their collating sequence.  Storing an ASCII zero will be reported as X'30' while an EBCDIC zero will be reported as X'F0'.

Once this display appears, you place characters into the clipboard as follows:


Using the left mouse button, click on any desired character in the grid.  Any prior contents of the clipboard are erased and replaced by the single character just clicked.


Using the right mouse button, click on any desired character in the grid.  The prior contents of the clipboard are retained, and the single character just clicked is appended to the end of the clipboard.


Note that this same display can be brought up and used in an edit session by means of the keyboard primitive function (CharSet), which you would have to map to a key of your choice.  For example, suppose you mapped Ctrl-Shift-A to (CharSet).  Then, while editing a file, if you needed a special character inserted, press Ctrl-Shift-A, and this window will appear.  You then place the desired key(s) into the clipboard, dismiss the window by clicking on the X, and then paste the character(s) into the desired location, which for most users would be done by pressing Ctrl-V (or using the right mouse button, if you have configured your mouse to operate that way).


Finally, you can use SPFLite itself to create special characters by editing in HEX mode.  Once you have composed the characters you want, set HEX OFF, and then using the mouse or cursor keys, highlight the desired text and copy it into the clipboard.


Key Mapping Limitations


As mentioned previously, not just function keys can be mapped, but almost any key can be user-customized.  Which keys cannot be mapped?  An obvious one is Ctrl-Alt-Delete.  Any key sequence that Windows has reserved for its own uses can't be mapped.  SPFLite has marked some of these as This entry is Reserved, Do NOT use.  Even if SPFLite itself doesn't mark or prevent you from mapping a reserved key, your system may still prevent its use.  If you are curious about which key combinations may be reserved, one description can be found at the web site http://windows.microsoft.com/en-US/windows7/Keyboard-shortcuts.  This list of reserved keys is sensitive to the version of Windows you are running, as well as to optional Windows run-time parameters you may have set, such as Accessibility shortcuts.


Some key sequences used in Microsoft software are merely conventions, and strictly speaking, are not “reserved”.  For example, Microsoft uses Ctrl-C for “copy” and Ctrl-V for “paste”, but these are just conventions; they are not reserved.  You can map Ctrl-C and Ctrl-V in SPFLite to do anything you wish.


These conventions still apply to any "control" or "dialog" or other GUI displayed by Windows itself, where keys like Ctrl-C and Ctrl-V mean what Windows says they mean, and nothing else.


There are a few basic keys that cannot be mapped.  These are the Shift keys, the Windows keys (the ones with the "flag" on them), and the Caps Lock key.  (However, the Windows Application key is fully mappable.  In the picture below, the Application key is just to the left of the right Ctrl key.  If you click on it, the name for the key will display as APPMENU.)


Some keys have only limited mapping, so that partial mapping is permitted, but not with all 8 possible combinations of Shift, Ctrl and Alt.  These limited keys are Escape, Scroll Lock, Tab, and the Ctrl and Alt keys themselves.  (Users of SPF-style editors on the PC will often map the right Ctrl key to (Enter) in SPFLite, since it simulates the Enter key on a 3270 terminal.)  When you click on a key for which only partial mapping is available, the chord combinations you are not allowed to use will be grayed-out.


Some keys like Alt-Tab are reserved to swap between various Windows applications that are running at the same time.  If SPFLite mapped this key, you'd never be able to Alt-Tab out of SPFLite to do something else.  So, even if it were technically possible to "grab" these keys (which, in some cases, it is), it wouldn't be a good idea.  SPFLite is already mapping as many keys as it can, and it's not likely to be able to increase the list of mappable keys beyond what it's doing now.  (Believe me, I've already asked George to support everything humanly possible right now - RH)


By the way, you should be aware that you can map the Pause key as well.  Most software totally ignores this key.  This might open up some useful possibilities for a command you used frequently and wanted to dedicate to a specific key.



A cautionary note about key mapping


As you are about to see in the next section, key mapping can be quite involved, powerful, and even fun - if you enjoy maximizing its features.  If you are a good typist with good dexterity, you can greatly benefit from what SPFLite's key mapping has to offer.


However, if you are not that great a typist, at times you could find yourself inadvertently hitting the wrong keys or key chords, more often than you'd like.  If you load up many different keys with many "shift combinations" like Ctrl-Shift, Ctrl-Alt and Alt-Shift, etc. you could end up performing editing actions by accident that you didn't intend, possibly ones that are hard to correct or undo.  This is especially true if you are what is colorfully called "fat-fingered," or if you type a lot while your hands (or the rest of you) are tired.  You could also end up with so many key definitions that you start forgetting what they are.


If that describes you, overloading the key mapping system with a very large number of key definitions may not be a wise choice, and could end up making the use of SPFLite a more frustrating experience than you would prefer.


So, the cautionary note is to 'know yourself' as to whether making your keyboard setup very complicated is a good idea or not.  Don't get so carried away that you make things worse instead of better!


Created with the Personal Edition of HelpNDoc: Free PDF documentation generator