Run-time Menus
Functions Introduced:
The
ProMenuStringsSelect() function enables you to set up a menu at run time. You do not need to supply a menu file because the buttons are defined when you display the menu. You cannot attach command functions to the button; a run-time menu simply returns a list of the buttons selected.
A run-time menu is displayed together with a submenu that contains the following buttons:
• Done Select
• Quit Select
• List
The default option, List, causes the string menu itself to be displayed.
You can set the maximum number of items you want to be selectable. The function returns when the user has selected the maximum number of items you specified, or has selected Done or Quit. uses this type of menu to select a disk file to be retrieved after the user selects Search/Retr.
The maximum size of the string you assign to a button is PRO_NAME_SIZE - 1. PRO_NAME_SIZE is defined in file ProSizeConst.h.
The function
ProMenuFromStringsRegister() creates menus at run time and attaches actions to the menu buttons. The function takes as arguments all the information required to create auxiliary (
*.aux) and user-defined (
*.mnu) menu files. The first argument is the default menu name. The next argument enables you to specify an alternate name for the menu if, for instance, your application supports a foreign language. The list of button labels is passed to the function as an array of wide character strings. As with the menu name, you can provide alternate button labels for foreign language support. You can also provide one-line Help for each button.
After you have registered the menu with a call to the function
ProMenuFromStringsRegister(), you can attach actions to the buttons by calling the function
ProMenuButtonActionSet() for each button. You must also define an exit action for your run-time menu. To do this, call
ProMenuButtonActionSet() and supply the name of the menu instead of a button name. Finally, create the menu by calling
ProMenuProcess(), and then
ProMenuCreate().
Parent topic