Keyboard Customization and Keyboard Macros

Contents of Article


Introduction

Key Mapping does not apply to Windows dialogs

Nothing can go wrong, go wrong

Start SPFLite directly into KEYMAP

Starting Over

Planning Ahead for Recovery

The KEYMAP LIST


Introduction


Since most interaction with an editor is through the keyboard, the ability to customize it greatly affects your productivity.  The Key Mapping features in SPFLite reflect the importance of this.


The Keyboard tab of the Options dialog provides basic on/off options to control scrolling using the arrow keys, whether the editor defaults to Insert Mode, and how Insert Mode Reset is handled.  See Options - Keyboard for details.


All other keyboard customization is performed in the Keymap dialog.  This dialog is reached by entering the KEYMAP primary command.


You can also use the KEY or KEYS aliases to bring up the same Keymap dialog, similar to ISPF.


From this dialog you can:


As mentioned in the Welcome to SPFLite, the the KEYMAP facility and mappable keyboard functions play an important role in providing many of the powerful features of SPFLite.  IBM ISPF did not give as much emphasis to this, because 3270 keyboards only allowed for mapping of PF keys, whereas SPFLite can map almost anything.  The time you spend learning about this facility will be well worth the effort.


Key Mapping does not apply to Windows dialogs


It is important to remember that SPFLite Key Mapping only applies to the File Manager and Edit/Browse screens.  Such screens are under the direct control of SPFLite, and so it is able to read and interpret keyboard scan codes and mouse activity according to how you set up your Key Mapping.


When you see "dialogs" that are under the management of Windows itself, SPFLite Key Mapping does not get involved.  That is because, while SPFLite has requested such dialogs to appear, it is Windows itself that drives and handles such dialogs.  SPFLite is only "notified" when the dialog is completed.  Because of that, SPFLite does not see individual keyboard and mouse actions, and is in no position to interpret them using your Key Mapping definitions.


Thus, there are "two worlds" - the world of SPFLite and its Key Mapping definitions, and the world of Windows dialogs - and these two worlds never meet.


When Windows dialogs appear, you can only use keys as they are understood by Windows.  So, when a "Enter" is required, you must press the key labeled "Enter", and not some other key mapped to (Enter), such as Right-Ctrl.  Copy to clipboard must be done by Ctrl-C, paste from clipboard must be done by Ctrl-V, etc.  Such Windows-managed dialogs include, for example:




Nothing can go wrong, go wrong ...


Murphy's Law suggests that at some point, somehow, you will end up with a messed up keyboard definition and need a way out.  If you can still enter commands, then issue KEYMAP, and carefully check each suspicious key one at a time, until you find the cause of your problem.  You can also see a list of every defined key mapping by using the KEYMAP LIST command, discussed below.


But what if you can't get into the Key Map?  Read on.


Start SPFLite directly into KEYMAP


You can start up SPFLite using a command line option -KEYMAP which will bring up the KEYMAP dialog.  Once you close the KEYMAP dialog, SPFLite will start up normally.


Because this is a type of "emergency startup contingency", SPFLite will not have completely finished all of its initialization steps when you get to the KEYMAP dialog.  As a result, the dialog will be displayed with a default font rather than your customary editing font.  Don't worry about that for now.  After you finish, and when SPFLite begins normal operation, the customary editing font will appear when you issue a KEYMAP command again.


See Starting and Ending SPFLite for more information.


Starting Over


This may be the simplest way, if you're just starting the key customization process.   Just delete the SPFLite.KBD file from your SPFLite data directory (which is normally \My Documents\SPFLite).  When you restart SPFLite, a new keyboard definition file with the standard defaults is recreated for you.  If you do this, you will lose any keyboard customization you may have done, but at least when you restart, SPFLite will be usable, and you can try doing your keyboard customization afresh.  


Planning Ahead for Recovery


There seems to be two kinds of SPFLite users, as far as keyboard configuration goes:


If you find yourself in the "go crazy" category (it's alright - we won't tell anyone !) you may wish to plan ahead in case you update your Keymap and then later wish that you hadn't.  Just make sure that you have a backup copy (perhaps several) of the SPFLite.KBD file.


A convenient way to organize this is to make a copy of the KBD file with the current date as part of the name, like SPFLite-2013-1204.KBD.


You can store these backups anywhere you like, of course, but it may be easiest to keep them in the SPFLite directory, just so they will be convenient and on-hand when you need them.  (SPFLite will never use or modify these backups.  It only looks in the SPFLite directory for a file exactly named SPFLite.KBD and nothing else.)   If you change your keyboard mappings frequently, at least keep a few older copies, so that if you need to restore it, you won't have to go back too far, and won't have to remember every change you've made recently.


If you like, you could also use this naming convention for the KBD file that is first created when you install SPFLite.  Some people like the string "orig" to mean the "original version" of a file.  If you like that idea, you could make a backup of your first KBD file after installation and call it SPFLite-orig.KBD.


As long as you have a recovery plan, you should be ready for any eventuality.  If you ever run into keyboard problems that you can't seem to fix, just copy one of your saved KBD backup files back to SPFLite.KBD, restart SPFLite, and you should be good to go!


The KEYMAP LIST


In order to help you examine the contents of your entire "keymap inventory", you can issue the command KEYMAP LIST.  When you do this,


Because you are in an SPFLite-controlled edit screen when this happens, you have available to you all the editing features of SPFLite, including the ability to FIND, SORT, EXCLUDE, and so on.  


You can create a permanent file by issuing a SAVEAS command, or paste the data into an application outside of SPFLite.  


The data you see can be changed in any way you like; changing it will not affect SPFLite's KEYMAP system.  Only the KEYMAP dialog can do that.  So, you can safely do anything you wish to this data.


Created with the Personal Edition of HelpNDoc: Create cross-platform Qt Help files