SET KEY TO
Map a menu option to a control or function key in a form
SET KEY TO <expN>
The SET KEY TO <expN> command is used in custom screen formats to map a menu option to a function or control key.
A screen format file, which is activated with the SET FORMAT TO <.fmt filename> command, can contain a form definition using @...SAY...GET commands, and can also contain a menu definition using @...MENU commands. When the form is activated by one of the full screen forms based commands APPEND, CHANGE, EDIT, INSERT, QUERY or READ, the form is displayed on the screen and data input mode is entered. If the [MENUBAR] key is pressed, then any @...MENU commands which have been defined in the screen format file are activated. You can then specify the SET KEY TO <expN> command as the command on the @...MENU command.
If you issue the SET KEY TO -1 command, activated from a menu selection, the menu will be exited. The CTRL() function is often used with the SET KEY TO command. The Screen Painter, initiated with the CREATE SCREEN command, allows menu items to be built into forms.
NOTE: It is important to distinguish this command from the SET KEY <expN> TO <procedure name> command, which has a different purpose. An alternative to the SET KEY command is to use the KEYBOARD command.
// Dataentry.fmt @0,0 say "Next" @0,0 menu "Next"; command "set key to ctrl(’n’)" @0,5 say "Prev" @0,5 menu "Prev"; command "set key to ctrl(’r’)" // The form would now be defined return use patrons index events, dates, names set format to dataentry change