Using Cascading Menus

Windows lets you provide more than one level of pop-up menus. Such multilevel pop-up menus are called cascading menus. Such a menu structure can help minimize the number of commands on a single pop-up menu, without requiring a dialog box to let the user refine his or her choice.

If you use QuickCase:W, it can create cascading menus for you.

Figure 19.1 shows an example of cascading menus.

In this example, the user chose the Software menu, then chose the Languages command from the Software menu. At this point, the Languages pop-up menu appeared to the right of the cursor. The user chose C from among three Languages pop-up menu choices. The C pop-up menu then appeared, and the user chose QuickC.

Cascading menus are simply nested pop-up menus. The menu definition for the example in Figure 19.1 looks like this:

MenuMenu MENU

BEGIN

.

.

.

POPUP “&Software”

BEGIN

POPUP “&Word Processing”

BEGIN

MENUITEM “&Word 5.5”, IDM_WORD

MENUITEM “W&rite”, IDM_WRITE

END

POPUP “&Spreadsheet”

BEGIN

MENUITEM “&Microsoft Excel”, IDM_EXCEL

MENUITEM “&1+2=4”, IDM_124

END

POPUP “&Languages”

BEGIN

POPUP “&C”

BEGIN

MENUITEM “C &6.0”, IDM_C60

MENUITEM “&QuickC”, IDM_QUICKC

END

MENUITEM “Quick&Basic”, IDM_QUICKBASIC

MENUITEM “Quick&Pascal”, IDM_QUICKPASCAL

END

END

.

.

.

END

NOTE:

A cascading pop-up menu has its own menu handle. To manipulate items on a cascading pop-up menu, you must first get its menu handle by calling the GetSubMenu function.