Key Activation Example
The application's mapping file includes the following:
/* Menu Key */
menu = pf1 (F1)
/* FRS command - print contents of screen */
printscreen = controlG (Ctrl-G)
/* First item on menu line */
menuitem1 = pf5 (F5)
/* Second item on menu line */
menuitem2 = pf6 (F6)
/* Third item on menu line */
menuitem3 = pf7 (F7)
/* Fourth item on menu line */
menuitem4 = pf8 (F8)
/* Fifth item on menu line */
menuitem5 = pf9 (F9)
/* Operation specified as FRS key 1 */
frskey1 = controlK (Ctrl-K)
/* Operation specified as FRS key 2 */
frskey2 = pf12 (Sh-F2)
embedded SQL (skeletal) program:
/* Operation code here */
exec frs display formname update;
exec frs initialize;
exec frs begin;
/* Initialization operations here */
exec frs end;
exec frs activate frskey1;
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Help';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Get';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Add';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'End', frskey2;
exec frs begin;
/* Operation code here */
exec frs end;
exec frs finalize;
The following menu line or key associations appear when a user runs the application:
Help(F5) Get(F6) Add(F7) End(Sh-F2)
The menu items appear on the menu line in the order in which they were defined in the application. The label to the right of each menu item indicates the key to which it is mapped.
The first three menu items map to their respective keys by position. For example, the following statement in the application's mapping file maps the menu item in the first position on the menu line to F5:
menuitem1 = pf5 (F5)
This enables the end user to press F5 as an alternative to selecting the menu item Help by other means. The labels for the Get and Add menu items show a similar positional mapping.
The mapping file has a corresponding statement for the fourth menu item, which allows that item (End) to be invoked with F8:
menuitem4 = pf8 (F8)
The label for End in the menu display example indicates a mapping to Sh-F2 with the label (Sh-F2), rather than F8. To understand why, look back at the last operation defined in the application. The operation includes activations both for menu item End and for frskey2. Because of this, the user can invoke the operation either by pressing the key mapped to the End menu item by position, or by pressing the function or control key to which frskey2 has been mapped (in this case Sh-F2). The label for a menu item associated with a FRS key activation always indicates the FRS key mapping, rather than any mapping based on the menu item's position on the menu line.
In this example, the Menu key is F1. This was specified in the mapping file with the FRS command menu. The mapping file also mapped another FRS command, printscreen, to Ctrl-G. The printscreen command enables the user to send the contents of the screen to a file or a printer. Because this operation is implemented with a FRS command, it requires no coding within the application.
The first operation specified following initialization is not a menu item operation, but a FRS key operation for frskey1. The menu line indicates only operations that can be activated by menu items; therefore, the frskey1 operation does not appear in the menu. The only way a user can select this FRS key operation is by pressing the control or function key that has been mapped to it in the key mapping file. Because the example mapping file maps frskey1 to Ctrl-K, the user can invoke the operation with Ctrl-K.
The next example uses the same mapping file as above.
exec frs display formname another;
exec frs initialize;
exec frs begin;
/* Initialization operations here */
exec frs end;
exec frs activate menuitem 'Help', frskey1;
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Find';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Add';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Delete';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'Forget';
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate menuitem 'End', frskey2;
exec frs begin;
/* Operation code here */
exec frs end;
exec frs activate frskey3;
exec frs begin;
/* Operation code here */
exec frs end;
exec frs finalize;
This example generates the following menu line or key associations:
Help(CtrlK) Find(F6) Add(F7) Delete(F8) Forget(F9) End(Sh-F2)
The first menu item, Help, can be activated by a key mapped to a Forms Runtime System key, rather than to its position on the menu line. The next four items are invoked by keys associated with their positional mappings.
The End menu item has no positional mapping entry in the mapping file. Instead, the operation's definition includes an activation by frskey2, which is mapped to Sh-F2 in the mapping file. Because the menu item lacks a positional mapping, Sh-F2 is the only control key or function key that can be used to invoke the operation.
The final operation in the application specifies an activation by frskey3. Because the mapping file contains no mapping for frskey3, however, the user has no way of accessing this operation. Be sure that your mapping file includes entries for all FRS keys specified in your application.