Setting the Menu Form Options

Several form options directly affect the processing of menus. The option settings are local to the specified menu form. The options available for menus are listed in Table 22.1. Note that MNAUTOSELECT is normally specified in the call to mn_def() or mn_defauto() when defining the menu form. You can change this option at a later point during the program.

When a menu form is defined, FLDCHSELECT, MNTOPESCAPE, MNREDISPLAY, MNMSGAUTOPLACE, and FMWRAP are set ON by default. All other menu options are OFF.

Designer: You can change the menu options for any menu in the Designer. See the Designer User's Guide for more information. You can also change the options in your code, by calling smn_opt() as described below.

Code: To change the menu options for any particular menu or sub-menu, call the set menu options function, smn_opt():

void smn_opt(options, state, mfmp)
 
int options;
/* Option(s) to set
*/
int state;
/* State to change option(s) to (ON or OFF)
*/
MFORMPTR mfmp;
/* Pointer to menu form
*/

The function smn_opt() does not change the settings for any form options not specified in the call.

For example, to set FMWRAP OFF for the sub-menu sub_mfmp call:

MFORMPTR sub_mfmp;



sub_mfmp = mn_defauto(MNAUTOSELECT, LNORMAL, BDR_NULLP);

smn_opt(FMWRAP, OFF, sub_mfmp);

smn_opt(MNCONFIRM, ON, sub_mfmp)

In this case, menu sub_mfmp has the following options ON: FLDCHSELECT, MNTOPESCAPE, MNREDISPLAY, MNMSGAUTOPLACE, MNAUTOSELECT, MNAUTOPLACE, and MNCONFIRM. (FLDCHSELECT, MNTOPESCAPE, MNREDISPLAY, and MNMSGAUTOPLACE are ON by default. MNAUTOSELECT and MNAUTOPLACE are set to ON by the call to mn_defauto(). MNCONFIRM is set to ON by the second call to smn_opt()).

Table 22.1: Menu Form Options

Menu Option Action When Option is ON
CURSORFREE If ON, the user is able to move freely between fields on a form by using the arrow keys. This includes vertical cursor movement with the Up Arrow and Down Arrow keys. If moving left or right, there must be a field defined to the left or right, or no movement occurs. When this option is OFF, the user can only move between fields on the form in the order in which they were defined. If the sub-menu for any field in the menu is MNAUTOSELECT, CURSORFREE is not as useful, because the sub-menu is automatically displayed and made active.
FMALTERED Forces a redisplay of the menu. For example, this option is useful when you are using checkmarks on your menus and are toggling the check marks directly instead of calling the system function CHECKMARK(). You can set FMALTERED to ON to inform the system that the menu has been altered and should be redisplayed.
FMWRAP When moving forward from the last field on a menu, the highlight bar moves to the first field. Likewise, when moving backward from the first field on a menu, the highlight bar will move to the last field. FMWRAP is disabled if CURSORFREE is ON
MNAUTOPLACE Automatically places the menu. If the menu is a top-level menu, it appears at (0, 0). If the menu is a sub-menu, it is automatically placed under the current item on the parent menu, if possible
MNAUTOSELECT The menu will automatically be displayed when the user highlights its calling menu field (valid only for sub-menus). This option should be OFF for top-level menus.
FLDCHSELECT The user can select a menu field by typing the selection character. The selection character is by default the first letter in the field. If more than one field starts with a character, the highlight bar selects the next menu field that starts with the typed letter.
MNCONFIRM When enabled with FLDCHSELECT, the menu field is highlighted when the user types the associated selection character. The user must then press the Menu Selection key to initiate the action function. This option is useful for menus that contain several fields with the same selection character.
MNMSGAUTO-
PLACE
The message window (if there is one) is automatically placed immediately below the active menu form.
MNREDISPLAY When the user jumps from a sub-menu to a menu that is several levels up, each sub-menu is retrieved and displayed until the desired level is reached. Caution: Turning off menu redisplay only works correctly for standard menus.
MNTOPESCAPE Pressing the Quit key (KEY_ESC) at the top-level menu causes a return from the menu processing function. (When MNTOPESCAPE is OFF, you must provide an "EXIT" action field; otherwise, the user will never be able to exit the menu.)

More:

More About Menu Redisplay


Home Contents Previous Next