Menus

Just like regular GUI windows and dialog boxes, DDT dialogs can use menus too. With just a handful of statements, you can create a menu and add or remove items, depending on the context of your application.

A menu bar is positioned just below the caption bar of a dialog box. From this menu bar, popup menus (or sub-menus as they are also known) can be displayed, each containing commands. Popup menus may contain even deeper levels of popup menus.

Menus are constructed in a hierarchical manner: the top-most level is positioned on the menu bar, and the lower levels of the menu are the popup portions. The items on the menu bar are always visible, but the popup menus are never visible until a menu bar item is either clicked by the mouse, or activated by a command accelerator (hot-key) which is indicated by an underscored character in the menu item text.

Please note that command accelerators differ slightly from keyboard accelerators. The latter are configured and described in the ACCEL ATTACH statement topic.

Typically, a popup menu contains a range of associated commands. For example, a FILE popup menu usually contains a range of commands to permit the opening, saving and closing of files, etc.

When the user activates a popup menu item, and a command is selected, a %WM_COMMAND message is sent to the dialog Callback Function to notify the program that a menu item has been selected.

 

See Also

Menu Walkthrough

More on the Menu

Menu State

Menu Example