MENUS

A window's menu bar is displayed immediately below the caption bar. This menu bar is sometimes called a program's ”main menu“ or the ”top-level menu.“ Items listed in the top-level menu almost always invoke a drop-down menu, which is called either a ”popup menu“ or a ”submenu.“ Beginning with Windows 3, you can define multiple nestings of popups: that is, an item on a popup menu can invoke another popup menu. Sometimes items in popup menus invoke a dialog box for more information. (Dialog boxes are covered in Chapter 10.) Most parent windows have, to the far left of the caption bar, a box containing a single line. This box invokes the system menu, which is really another popup menu.

Menu items in popups can be ”checked,“ which means that Windows draws a small check mark to the left of the menu text. The use of check marks lets the user choose different program options from the menu. These options can be mutually exclusive, but they don't have to be. Top-level menu items cannot be checked.

Menu items in the top-level menu or in popup menus can be ”enabled,“ ”disabled,“ or ”grayed.“ The words ”active“ and ”inactive“ are sometimes used synonymously with ”enabled“ and ”disabled.“ Menu items flagged as enabled or disabled look the same to the user, but a grayed menu item is displayed in gray text.

From the perspective of the user, enabled, disabled, and grayed menu items can all be ”selected“ (highlighted). That is, the user can click the mouse on a disabled menu item, or move the reverse-video cursor bar to a disabled menu item, or trigger the menu item using the item's key letter. However, from the perspective of your program, enabled, disabled, and grayed menu items function differently. Windows sends your program a WM_COMMAND message only for enabled menu items. You use disabled and grayed menu items for options that are not currently valid. If you want to let the user know the option is not valid, make it grayed.