Function ExecMenu

Top 

Declaration:

int ExecMenu(char title[], char items[], int start_sel=0);

Description

Displays the dialog menu on the screen.

Parameters:

  title     - the dialog box title;

  items     - the line describing the menu items. Every item ends with the zero

              byte; the last item ends with two zero bytes.

  start_sel - the number of the menu item that will be selected by default,

              when the window opens.

Returned value

The number of the menu item selected by the user or -1, if the Cancel button or Esc key is pressed. The selected menu line is copied to the SelectedString[] built-in variable. If the user cancels the selection, then the null string will be copied to the Selected String.

Example

  int choice =

    ExecMenu("Choose program to load",   // the title

             " Load Example #1 \0"

             " Load Example #2 \0"

             " Load Example #3 \0"       // the items

             "\0");                      // the second zero at the end

  switch (choice)

  {

    case 0:  LoadProgram("EXAMPLE1.OMF", LF_UBROF); break;

    case 1:  LoadProgram("EXAMPLE2.OMF", LF_UBROF); break;

    case 2:  LoadProgram("EXAMPLE3.OMF", LF_UBROF); break;

    default: printf("No example will be loaded");

  }