STRMENU Function

STRMENU creates and displays a dialog box with an option group and returns the selection that the user makes.

STRMENU has the following syntax.

OptionNumber := Dialog.STRMENU(OptionString [, DefaultNumber]);  

OptionNumber is the number of the option that the user chooses. The first option in OptionString is number 1. If the user closes the dialog box with ESC, then STRMENU returns 0 (zero). If it is defined, then DefaultNumber is used to select the default option. If DefaultNumber is not defined, then option number 1 is used as the default.


The following example creates a window with the following options:

  • Save

  • Close

  • Cancel

    The window also has an OK button and a Cancel button.

    This example requires that you create the following variable.

Variable Data type
Selection Integer
Selection := Dialog.STRMENU('Save,Close,Cancel',3);  

In this example, the Cancel option is the default because the DefaultNumber parameter was set to 3. We recommend that you set the default to a harmless action, such as cancel, because this option can be selected by pressing Enter. If the user accidentally presses Enter, nothing catastrophic occurs, as might be the case if the default option was "Delete all."

See Also

STRMENU Function (Dialog)
Progress Windows, MESSAGE, ERROR, and CONFIRM Functions