menuAppendString


function menuAppendString(text: string): integer;

Appends a string entry to current menu. The function returns the index of the new entry within the menu.

  var tetris, minesweeper, snake : integer;
      play, clicked : command;	
  begin
    showMenu('Select a game', CH_IMPLICIT);
    
    tetris := menuAppendString('Tetris');
    minesweeper := menuAppendString('Minesweeper');
    snake := menuAppendString('Snake');

    play := createCommand('Play', CM_SCREEN, 1);
    addCommand(play);

    repeat
      delay(100);
      clicked := getClickedCommand;
    until clicked = play;

    showCanvas; // show canvas and remove menu from the screen

    if menuGetSelectedIndex = tetris then playTetris;
    if menuGetSelectedIndex = minesweeper then playMinesweeper;
    if menuGetSelectedIndex = snake then playSnake;
    ...
  end.

See also: showMenu, menuAppendStringImage, menuIsSelected, menuGetSelectedIndex