home *** CD-ROM | disk | FTP | other *** search
- menu2.c -- a menu display and selection routine
-
- ************* Copyright 1985 by Vermont Creative Software **************
-
-
- USAGE
-
- To display a pop-up menu on a screen, allow menu selection, and then
- restore the original screen content.
-
- FUNCTION
-
- This function displays a menu that resides in a memory file.
-
- Menus have the following format:
-
- Menus can consist of any number of items.
-
- Menu items can be arranged in one or more rows, and each row can
- have one or more items. The same number of items must be on each
- row except the last one.
-
- The same space must be allocated to each item in the menu. Use
- spaces to pad items to make them all the same length.
-
- The window in which the menu is to be displayed is passed as an
- argument of menu2(). Additional parameters specify the number of items
- in the menu, number of characters per item, the number of items per row
- and the default position of the bar cursor.
-
- The menu-window is made a pop-up window.
-
- The menu-window is placed on the screen and the menu text moved to the
- window.
-
- The default item is highlighted.
-
- Highlighting is accomplished by using a sub-window that is
- one-menu item in size. The sub-window is placed over the menu
- item, and v_natt is called to change the text attribute within the
- window to REVERSE or LREVERSE.
-
- Cursor pad keys are used to move the highlight area to other menu
- items.
-
- Pressing the enter key "selects" the menu item highlighted, which
- causes the following sequence:
-
- The original screen is restored.
-
- The code number of the menu item is returned on exit.
-
- The cursor is restored to its original position.
-
- Source code for this function is included on the system diskette.
-
- COMMENT
-
- This program illustrates how the capabilities of Windows for C can be
- used to program a high-quality menu selection display.
-
- Pop-up windows are implemented just by designating the window to be
- a pop-up as opposed to an overwrite window.
-
- The capability to change the attribute of a section of a window is
- provided by v_natt().
-
- v_natt() is used in menu() to highlight the selected menu items.
-
- Highlighting is accomplished by placing a small window just the
- size of one menu-item space over the menu item and then using
- v_natt() to change the attribute of the window to REVERSE.
-
- When a menu item is de-selected, v_natt() is used to restore the
- original attribute.
-
- The status line that displays the number of the selected menu item
- provides another illustration of the ability of Windows for C to
- simplify screen management.
-