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

STRMENU has the following syntax.

  CopyCode imageCopy Code
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 form with ESC, STRMENU returns 0 (zero). If it is defined, DefaultNumber is used to select the default option. If DefaultNumber is not defined, 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



  CopyCode imageCopy Code
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 inadvertently presses ENTER, nothing catastrophic happens, as might be the case if the default option was "Delete all."

See Also