You can provide more than one level of pop-up menus in your applications. Such multilevel pop-up menus are called cascading menus. A multilevel menu structure can help minimize the number of items on a single pop-up menu, without requiring a dialog box in which the user refines his or her choice. The following figure shows an example of cascading menus:
In this example, the user selected the Software menu and 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 then moved the cursor over the Languages pop-up menu and chose “C.” The C pop-up menu then appeared, from which the user chose either C version 7.0 or QuickC (Microsoft QuickCÒ).
Cascading menus are simply nested pop-up menus. The menu definition for the preceding example in figure looks like this:
MenuMenu MENU
BEGIN
.
.
.
POPUP "&Software"
BEGIN
POPUP "&Word Processing"
BEGIN
MENUITEM "&Word 5.0", 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 &7.0", IDM_C60
MENUITEM "&Quick C", IDM_QUICKC
END
MENUITEM "Quick &Basic", IDM_QUICKBASIC
MENUITEM "&PASCAL", IDM_PASCAL
END
END
.
.
.
END
Note:
A cascading pop-up menu has its own menu handle. To control items on a cascading pop-up menu, you must first retrieve a handle of the menu by calling the GetSubMenu function.