Hiding and Showing a Menu Tree

You can hide a menu and one or more of its parent menus and later redisplay all of the menus that you hid.

Caution: Menus must be pop-up to use mn_hide() and mn_show(). By default, all menus are pop-up.

To hide a menu tree, use the menu hide function, mn_hide():

int mn_hide(action_code, start_mfmp)
 
int action_code;
/* Code indicating how many menus to hide
*/
MFORMPTR start_mfmp;
/* Pointer to lowest-level menu to be hidden
*/

For the action code, you specify how many menus to hide. Possible values are:

MN_CUR Hides the current menu only
MN_SUB Hides all menus up to, but not including, the top-level menu
MN_ALL Hides all menus in this branch of the menu tree (including the top-level menu)


As an example, look at the menu tree in Figure 22.1. At this point, the only menu you can call mn_hide() for is d2mfmp, since it is the lowest-level menu in the tree. If you pass MN_CUR as the action code, only d2mfmp is hidden. If you pass MN_SUB, both d2mfmp and dmfmp are hidden. If you pass MN_ALL, all three menu forms are hidden.

Figure 22.1: Example for menu tree hide/show

To make the menus reappear, call mn_show(). The call for mn_show() is as follows:

int mn_show(action_code, start_mfmp)
 
int action_code;
/* Code indicating how many menus to show
*/
MFORMPTR start_mfmp;
/* Pointer to lowest-level menu to be shown
*/

You must pass the same arguments to mn_show() that you passed to mn_hide(). If you do not, the images of the menus on the screen could be corrupted.

You must pair a call to mn_hide() with one to mn_show() or call mn_dn() for each menu hidden. The only exception is when you are hiding menus from within a menu action function, and you return to a menu that is still displayed; in this case, the menu editor calls mn_dn() to get up to the displayed menu.


Home Contents Previous Next