Chapter 7


A keyboard layout is a single repository for macros. Instead of accessing these macros by name, you press a key -- nearly any key, including cursor keys, function keys, and editing keys -- and the macro executes.

Keyboard layouts let you "re-assign" or "re-map" keys. You can substitute one key for another (the F1 key for the F3 for instance), or provide a complete, sophisticated macro that does everything but wash the dishes. You can use a keyboard to store all your macros, or you can use it to store just the ones you most often. And when all the keys in one keyboard layout are used up, you can create a whole new one. WordPerfect lets you create and instantly access any number of keyboard layouts.

In this chapter, you'll learn about creating your own keyboard layouts. You'll learn how to create new layouts, re-maps keys, assign multiple keystrokes to keys, import macros into layouts, and more. At the end of this chapter you'll find a summary of useful keyboard layouts that are provided on the Applications Disk, included with this book.



WordPerfect 5.1 offers the ability to reassign, or remap, nearly every key on the IBM PC keyboard. This includes the alphabet and number keys, the function keys, cursor keys, even keys that are normally dormant on your keyboard.

While this may not seem an important feature at first, it's one of the most constructive because you can make WordPerfect behave like nearly any other word processing program. For example, you can reassign some of the control key characters to provide WordStar-like cursor movements. You'll see exactly how this is done later in this chapter.

You can also change the definition of one or all of the function keys. Since I use the Reveal Codes key a lot, I prefer to have it readily available as the [F4] key instead of the standard [Alt]-[F4] key. With the key remapping feature, it's an easy process to switch the definitions of the two function keys.

The original IBM PC and clones used a keyboard that contained 83 keys. The cursor keys were combined with the numeric keypad, and the keyboard provided for 10 function keys, labeled F1 through F10. There have been a number of improvements to keyboard design since IBM introduced the PC in 1981. The latest and most popular design incorporates 101 keys, offers separate cursor keys and numeric keypad, and boasts 12 function keys (F1 through F12).

Most, but not all, of these 101-key keyboards use an enhanced BIOS chip that provided extended operation of some keys. For instance, even though the numeric keypad on an enhanced keyboard can also serve as cursor keys, the keyboard knows the difference between the 7 (or Home) key on the keypad and the separate Home key on the cursor keypad.

WordPerfect can be used with both un-enhanced and enhanced keyboards. With an enhanced keyboard, you have several dozen additional keys that -- while normally dormant and unused in WordPerfect -- can be re-assigned with any function you want. For instance, you can readily provide a function for the [Alt]-[End] key combination.

If you're not sure that type of keyboard you have, use the WPINFO program that accompanies WordPerfect 5.1 WPINFO checks the operating state, capacity, and features of your computer. Among the information provided is the type of keyboard you have connected to your computer.

If you don't have an enhanced keyboard, you may want to think about purchasing one. PCs, as well as most clones that are 100 percent IBM PC compatible, can usually accept enhanced keyboards. Cost is under $100 for a fairly good keyboard, even less if you shop mail order or computer swap meets.



The key layout feature is found as an option in the Setup menu. To create a new keyboard layout,

Key Sequence What it Does
1. [Shift]-[F1] Chooses Setup menu.
2. K Selects Keyboard Layout option.

At this point, you may either open an existing layout (if present) or create your own. WordPerfect comes with several keyboard layouts that you can try and use. For now, however, let's concentrate on making a new own.

IMPORTANT: If a keyboard layout has been previously selected and is currently active, an asterisk will appear next to it. If a layout is flagged on your computer, press O (letter O, not zero) to select Original. This cancels the keyboard selection. This is an important step because the selected keyboard layout is active, even when you are remapping keys in a new layout. Things can get confusing if you attempt to re-map a key that's already been remapped!

Keyboard layouts are contained within their own special files. WordPerfect automatically gives the file extension .WPK to keyboard layout files. When creating your own layouts, you should not provide the .WPK extension yourself. You can rename keyboard layouts from DOS or WordPerfect's List Files screen, but you should do not alter the .WPK extension. The currently selected keyboard, if any, is one of the pieces of setup information stored in the WP{WP}.SET file. If this file is ever damaged, erased, or moved, WordPerfect will loose all of its setup information, including the currently selected keyboard.

You can put the .WPK files on any disk or directory, but you must tell WordPerfect where to find them. Use the Location of Auxiliary Files option (in the Setup menu) to indicate a drive and/or a directory. Your choice applies to keyboard and macro files. If you don't use the Location of Auxiliary Files option, the keyboard layout files must be in the main WordPerfect directory.

Creating the Layout

Follow these quick steps when creating a new keyboard layout.

Key Sequence What it Does
1. C Selects Create command, to create a new, blank keyboard layout.
2. {name}
Names the new layout.

To Open a Keyboard Layout

At the point, only a blank keyboard layout file has been created. You must now open the layout if you want to re-map keys (and later, edit keys that have been already remapped).

Key Sequence What it Does
1. {cursor keys} Moves the cursor to the layout you want to use.
2. E Selects the Edit command; opens the layout for editing.

No keys have yet been assigned. The keyboard editing screen is blank.

Remapping a Key

Once the keyboard layout editing screen is displayed, you may now create new definitions for keys.

To remap a key,

Key Sequence What it Does
1. C Selects Create from the key edit menu. WordPerfect now prompts you to strike a key to remap.
2. {key} Selects a key to redefine. The keyboard edit screen automatically opens.
3. {description}
Describes the macro (this step is optional).


Editing the Keys

The keyboard editing window is essentially the same as the macro editor, and is used in exactly the same way.

The editing keys ([Delete], [Backspace], [Ctrl]-[End], etc) work as they do in the WordPerfect main document window (the general exception is the [Ctrl]-[Page Down] key). But what if you want to include an editing key as part of a key definition? You have two choices:

Since key assignments are really a form of macros, you have the full macro programming language arsenal at your fingertips. To access the programming statements, press [Ctrl]-[Page Up]. A pop-up window appears. Use the cursor keys to scroll through the commands. Add the one you want to the key definition by selecting it, then pressing [Enter]. Press [Esc] to exit the pop-up window without making a selection. A description of the purpose and use of the programming commands appears in Chapter 4, "Learning the Macro Programming Language."

Press Exit ([F7]) when you're done exiting the key. You are returned to the key editing menu, where you may create or edit another key, or perform one of the other functions below.

If you'd like to edit an existing key (one that is already re-mapped),

Key Sequence What it Does
1. {cursor keys} Moves the cursor to the layout you want to use.
2. A Selects Action command; opens key for editing.

Tip: You can also edit a key by moving to it with the cursor keys and pressing [Enter]instead of A.

Deleting Keys

Key definitions you no longer want can be deleted by selecting them, then pressing O, for Original (type the letter O, not the number 0). The option is called "original" because it deletes the selected key definition and returns that key to its original ("factory") WordPerfect value. As a safe-guard, you are asked if you really want to delete the key assignment; if so answer Y.

Moving Keys

You may move definitions from one key to another. This prevents you from having to manually re-enter the definition of a key, for instance, just because you want to change it from [Ctrl]-L to [Ctrl]-C (the individual key reassignments are not stored in separate documents, so you cannot duplicate them from within WordPerfect or in DOS).

To move a key,

Key Sequence What it Does
1. {cursor keys} Selects the key to move.
2. M Chooses the Move option.
3. {key} Selects new key to hold the assignment. If the new key has already been re-mapped, you are asked if you want to replace it with the new assignment.


Providing a Description

As with macros, you can provide a description for each key assignment you create. The description appears on the screen along with the key identification. If you'd like to provide a description, press D (for Description). Type the description (up to 39 characters) and press [Enter] when you are done.

Saving Keys as Macros

You may like a key assignment so much that you want to make it into its own macro. Or, more likely, you may want to share the assignment with someone else who doesn't want your entire assortment of remapped keys. You can save any key assignment in the following manner:

Key Sequence What it Does
1. {cursor keys} Selects the key assignment.
2. S Chooses Macro Save option.
3. {name} Names the macro and saves it [Enter]on the disk.

If you've indicated a specific disk or directory for keyboard layout files and macro files (using the Location of Auxiliary Files option under the Setup menu), WordPerfect automatically saves your macro in the indicated drive/directory. If you'd like it to be recorded someplace else, provide a full path, such as


Assigning Macros to Keys

If you have a macro that you want to integrate as a key definition, do the following.

Key Sequence What it Does
1. R Selects Macro Retrieve option.
2. {key} Selects the key you want to hold the macro definition.
3. {name} Indicates the macro you want [Enter]to use.

{KEY MACRO} Identification

Re-assigned keys that consist of more than one character (keyboard character, WordPerfect code, or macro code) are considered "key macros." WordPerfect uses the {KEY MACRO} designation to help keep track of remapped keys, and to differentiate between keys that produce a single character or code, and those that contain many characters and codes. This is crucial if you've included a re-mapped key in a macro or another key definition, as detailed more fully in Chapter 18: "For Pros Only: Advanced Techniques."

If the key has a single-function (you've remapped Help to the F1 key for example), that function is shown in the "Action" column in the keyboard editing screen. If the key is multi-function, it is listed as a {KEY MACRO}, and is given a number by WordPerfect. Key macro numbers are given to keys in the order you create them. They also change as you delete key assignments you no longer need. Likewise, macros you import into a keyboard layout are also defined as key macros.

Closing the Layout

When you're done defining keys, press Exit to return to the Keyboard Layout menu. There, you can select the keyboard layout if you want to start using it, delete it, create a new layout, and so forth. If you want to return to the WordPerfect editing screen without doing anything else, press the Exit key one more time.



The changes you make to a keyboard layout are not activated until you choose the layout. Once you have created or edited all of the keys you want,

Key Sequence What it Does
1. {cursor keys} Selects the keyboard layout you want to use.
2. S Chooses the Select command; selects the highlighted layout.
3. [F7] Leaves the Setup command menu; you are back to the main document.

Reverting to the Original Layout

The changes you make to the key assignments have no permanent effect on WordPerfect. You may revert to the original, standard keyboard layout at any time by pressing O, for Original, in the keyboard Layout menu. Be sure to press the letter O, not numeral zero.

Tip: As a shortcut, you can also press [Ctrl]-6 anywhere within WordPerfect to revert to the original layout. This approach cancels any previously selected layout for the current session of WordPerfect only. When you restart WordPerfect at some later date, the last layout you chose will be automatically reactivated.



You can design stand-alone macros that turn keyboard layouts on and off or choose others from the list. This is handy if you want to create key assignments that have different meanings depending on who's using the program, or depending on the kind of document you are currently editing. As an example, you can create a macro that turns the [Esc] key into a Cancel key at the start of an operation, then changes it back to its regular repeat function for the rest of the operation.

Macros are essentially blind when they are executing, and they actuate keys precisely as you entered them. If you've added keyboard layouts to the list, you'll never know how many times to press the down arrow cursor key to select the one you want. Fortunately, the keyboard layout menu includes a name search function.

Key Sequence What it Does
1. N Selects name search function.
2. {layout name} Choose a layout.
3. S Selects the layout.
4. [F7] Returns to the main document.

To create a complete macro that selects a keyboard layout, start macro definition, then go through all the steps necessary to select the new layout. Here are the general steps to create a macro called DVORAK.WPM that selects and activates a keyboard layout called DVORAK.

Key Sequence What it Does
1. [Ctrl]-[F10] Starts macro definition.
Names macro DVORAK.
3. Dvorak layout selector
Describes macro.
4. [Shift]-[F1] Selects Setup menu.
5. K Selects Keyboard option.
6. N Chooses Name search option.
Locates DVORAK layout.
8. S Chooses Select option.
9. [F7] [F7] Exits Setup menu.
10. [Ctrl]-[F10] Ends macro definition.



The Applications Disk includes four keyboard layouts. These keyboards have both a practical value -- you can use them in your day-to-day work with WordPerfect -- and they serve to acquaint you with the way layouts work. You'll find:



If you'd like to gain more experience in creating and editing key assignments, you can practice making your own keyboard layout. The following shows you step-by-step how to remap certain keys to provide basic WordStar cursor movement using WordPerfect. After you create your own WORDSTAR layout, you can compare it against the one provided on the Applications Disk. Assuming you follow all the steps to the letter (no pun intended) your layout should look and function the same as the one on the disk.

With the exception of the [Ctrl]-Y, [Ctrl]-R, [Ctrl]-C, and [Ctrl]-Q keys, the remapped keys have only a single function, such as {Word Left} for [Ctrl]-A and {Right} for [Ctrl]-D. These are relatively easy to enter in the keyboard editing screen. Multi-function keys require you to provide several WordPerfect function codes. The [Ctrl]-Q key also uses some of the advanced macro commands first detailed in Chapter 4, "Learning the Macro Programming Language."

Here's on overview of the keys used in the WORDSTAR keyboard layout.

Key Function Definition Keys to Press
[Ctrl]-A Word left {Word Left}   [Ctrl]-[Left]
[Ctrl]-C Screen down {Home}{Left} [Home] [Left] {Screen Down}+ (on keypad)
[Ctrl]-D Right char {Right} [Right]
[Ctrl]-F Word right {Word Right} [Ctrl]-[Right]
[Ctrl]-G Delete char. {Del} [Delete]
[Ctrl]-R Screen up {Home} {Left} [Home] [Left]   {Screen Up}  -(on keypad)
[Ctrl]-S Left char. {Left} [Left]
[Ctrl]-T Delete word {Del Word} [Ctrl]-[Backspace]
[Ctrl]-Y Delete line {Home}{Left} [Home] [Left]{Del to EOL}{Del}[Ctrl]-[End][Delete]

Let's review the process by creating the [Ctrl]-A key definition.

Key Sequence What it Does
1. [Shift]-[F1] Calls up Setup menu.
2. K Chooses Keyboard Layout option.
3. C Chooses Create option.
Names the keyboard layout "WORDSTAR." (The WordStar layout automatically opens for editing).
5. C Chooses Create key option.
6. [Ctrl]-A Names key as Ctrl-A.
7. Word Left key
Describes key definition.
8. [Delete] Deletes existing key definition.
9. [Ctrl]-[Left] Inserts {Word Left} code (press [Ctrl]-V first to insert the {Word Left} code).
10. [F7] Exits key editing screen. You can now create another key.

IMPORTANT: As in the macro editing screen, you must press [Ctrl]-V to tell WordPerfect you want to enter the code for the cursor key, rather than use the cursor key to move within the editing box. As shown in the previous example, to enter the {Word Left} code, press [Ctrl]-V, then press [Ctrl]-[Left].

Use the list above to create the other single-function keys. When creating the [Ctrl]-Ydefinition, insert each of the codes as indicated. Because you must enter a series of cursor and editing keys, when you are created the [Ctrl]-Y definition, temporarily turn editing off by pressing [Ctrl]-[F10]. Now, every key you press -- including cursor and editing keys -- are included. After you have inserted all the codes, press [Ctrl]-[F10] once more to turn editing back on.

The WordStar ^QR (beginning-of-document) and ^QC (end-of-document) cursor keys are a little tougher to implement. One way is to use WordPerfect's programming language, as shown here (remember that you don't type the numbers; they are shown for reference purposes only).

	  r~R~   {^R}~R~   R~R~
  	  c~C~   {^C}~C~   C~C~
2.   	{LABEL}R~
3.   	{LABEL}C~

The completed definition, shown in the keyboard editing box. Pressing the [Ctrl] and Q keys invokes the key definition. The macro waits for you to press either R (to go to the beginning of the file) or C (to go to the end). If you press any other key, nothing happens.

Note that if you don't press one of the keys WordPerfect is looking for, the macro quits. The {QUIT} command right after the end of the {CASE} command (end of Step 1) tells WordPerfect what happens if you press a key other than six being watched for.



Whether you create your own key definitions, or use those supplied from other sources, WordPerfect offers a number of housekeeping options you'll find helpful when working with keyboard layout files.

You access the Keyboard Layout menu by pressing [Shift]-[F1] (for Setup), then K (for Keyboard). You have none options:



The Map option in the Keyboard Layout menu allows you to see a "bird's-eye" view of the key definitions for any layout you choose. To see the map for any particular layout:

  1. Highlight the layout you want to view (it does not need to be currently selected).
  2. Press M (or 8) for Map.

The Map display shows the basic [Ctrl], [Alt], and character keys available in WordPerfect.

At the bottom of the map display is a handy summary that tells you the currently selected key, its contents (either a single code or a {KEY MACRO}, and a definition, if any. Use the cursor keys to move through the keys in the map.

The Map screen provides six additional functions:

When you're down with Map, press the Exit key to return to the Keyboard Layout screen.



Table 000 in Appendix E lists all the keys you can remap using the standard and enhanced keyboards (for more information on enhanced keyboards and how they work in WordPerfect, see the section About Keyboard Layouts, earlier in this chapter). Even with a standard keyboard, you can remap several hundred different keys. With that much flexibility given to you, it's easy to go overboard. You may re-map keys that are required for normal operation of WordPerfect, or you may have so many re-assigned keys that you forget which ones do what.

Before you tread too deeply into the jungle of keyboard layouts, take a few moments to think about how you want to approach key assignments. Develop your own game plan based on your needs, likes, and familiarity with WordPerfect's advanced functions. If you're like most users of WordPerfect, you'll use one -- or perhaps two -- keyboard layouts for 99 percent of the work you do. If possible, you should consolidate as many key assignments into one layout as you can. This cuts down on the number of layout changes you must make to access the key definition you want.

It also prevents you from using the same key for two different definitions. Although this re-use of keys is a basic feature of the keyboard layout, it carries with it the woeful side-effect of demanding that you remember which key definition goes to which keyboard. For example, [Ctrl]-C may be defined as one thing in layout A, and another in layout B. Unless you have a very good memory, you may forget which one does what.

WordPerfect does not provide a simple way to merge two or more keyboard layouts into one. You must do it manually. If the assignments are simple, you can re-write them key-by-key. If the assignments are more involved, however, you'll want to manually graft keys from one layout to another.

  1. Decide which layout you want to use as the "master." This is the layout you will be copying the other key assignments to.
  2. Select the keyboard layout that contain the keys you want to copy.
  3. Select one of the re-assigned keys in the layout.
  4. At the keyboard editing screen, choose the Save option, and give the key assignment a name. The key assignment is now a stand-alone macro file.
  5. Select the master layout.
  6. At the keyboard editing screen, choose the Retrieve option.
  7. Select a key to use and enter the name of the macro file you saved earlier.
  8. Repeat steps 2 through 7 for the remaining keys you want to copy.

No doubt you're thinking that a macro can greatly speed up and simplify this process. Create a keyboard-recorded macro that performs the steps for you. You will need to provide {PAUSE}s at each step to allow you to manually select the key you want to graft, to name the key assignment, and so forth.

For step 8, use one of the looping techniques detailed in Chapter 6, "Enhancing Keyboard Recorded Macros." Note that you cannot start a macro at any spot other than the main editing screen. The beginning of the macro will therefore contain commands to select the Setup and Keyboard menus. When looping back to perform steps 2 through 7, add a label at the beginning of step 2, and a {GO} command at the end of step 7. That will allow the macro to repeat the desired steps, without repeating the Setup and Keyboard codes.

Even if you use just one keyboard layout, it's a good idea to make a printed copy of the keyboard editing screen so you can refer to it when you're using WordPerfect. Unfortunately, WordPerfect doesn't permit you to directly print the contents of the keyboard editing screen. So you must either:

If you have more key assignments than will fit in one screen, make additional screen dumps. After the prints are made, cut out the key definitions and keep them handy at your computer. You may even want to reduce the printout (to make it more compact), and laminate it to protect it against the elements.

If you're using Shell, you can append two or more screen-fulls of key assignments into a single Clipboard clipping. With several screens worth of text, you can then retrieve it into a document, and print it out.

Tip: WordPerfect 5.1's equation editor is designed to be used with the equation keyboard layout supplied with the WordPerfect package. It's highly doubtful you'll ever use the equation layout when not using the equation editor. You don't need to choose the equation layout yourself, however. WordPerfect will do it for you, and revert back to your own layout when you're done creating and editing your equations. See the WordPerfect documentation for more details on this feature.



You can assign [Alt]-letter key combinations to keyboard layouts just as you can to stand-alone macros. When you press the [Alt] key and a letter key, WordPerfect first checks to see if you've assigned a keyboard layout key to that combination. If it finds a match, the key assignment is executed, even if you have a stand-alone macro that also uses the same [Alt]-letter combination. If there's no match, then the stand-alone macro is executed. Should WordPerfect find neither a matching key assignment or [Alt]-letter macro, is displays the message

ALT#.WPM not found

where # is a letter from A to Z.



WordPerfect 5.1 lets you quickly move to items adjacent to the cursor. An "item" is another cell in a table or another paragraph level. You can move to the item above, below, to the right, or to the left of the cursor. WordPerfect also lets you quickly move to the previous or next paragraph (a paragraph is defined as any text ending with a hard return).

If you have an enhanced keyboard, you can access these item and paragraph function using the following key combinations:

Item Up
Item Down
Item Right
Item Left
Para Up
Para Down

If your computer is not equipped with an enhanced keyboard, you can still access these functions. You can assign each function to the key of your choice using the keyboard layout feature. For ease of use, you may want to use [Ctrl]-key combinations for the item and paragraph functions. For example, [Ctrl]-U might be Para Up, and [Ctrl]-D might be defined as Para Down.

To assign the item and paragraph keys:

  1. Create or edit a keyboard layout. If you are editing a layout, check to see what keys are available. If a key you want is already in use, you may want to move it to another key.
  2. Choose the Map option at the Keyboard Layout menu.
  3. With the cursor keys, select a key you want to use.
  4. Choose the Macro option in the Map menu. The key editing window appears (this editing window is the same as the macro editing window).
  5. Delete any codes that are in the window, and press [Ctrl]-[Page Up] to view the list of macro commands.
  6. Use the cursor keys to scroll to one of the item or paragraph function codes (such as {Item Left}).
  7. Press the [Enter] key to insert the highlighted code into the editing box.
  8. Press the Exit key to close the editing screen.

Repeat steps 3 through 8 for each additional item or paragraph function you wish to map.



In this chapter you learned how to create, use, and edit keyboard layouts.

Key Sequence What it Does
1. [Shift]-[F1] Chooses Setup menu.
2. K Selects Keyboard Layout option.
3. C Selects Create command, to create a new, blank keyboard layout.
4. {name} [Enter] Names the new layout.
Key Sequence What it Does
1. {cursor keys} Moves the cursor to the layout you want to use.
2. E Selects the Edit command; opens the layout for editing.
Key Sequence What it Does
1. C Selects Create from the key edit menu. WordPerfect now prompts you to strike a key to remap.
2. {key} Selects a key to redefine. The keyboard edit screen automatically opens.
3. {description} [Enter] Describes the macro (this step is optional).
Key Sequence What it Does
1. {cursor keys} Selects the key assignment.
2. S Chooses Macro Save option.
3. {name}
Names the macro and saves it on the disk.
Key Sequence What it Does
1. R Selects Macro Retrieve option.
2. {key} Selects the key you want to hold the macro definition.
3. {name} Indicates the macro you want [Enter]to use.
Key Sequence What it Does
1. [Shift]-[F1] Chooses Setup menu.
2. K . Selects Keyboard Layout option
3. {cursor keys} Selects the keyboard layout you want to use.
4. S Chooses the Select command; selects the highlighted layout.
5. [F7] Leaves the Setup command menu; you are back to the document editing screen.


 Top Contents

WordPerfect 5.1 Macros and Templates
Electronic Edition
Copyright 1990, 1997, Gordon McComb.  All Rights Reserved.
First published by Bantam Electronic Publishing, 1990.