map_choose()

Purpose

Chooses an option from a menu

Syntax

int map_choose(mapnr, option)

Parameters

int mapnr

Number of map to display

 

int option

Pointer to variable to hold current selection

Description

The map_choose() function allows the user to select an option from a map. It is similar to the function field_choose(), but displays and removes the specified map.

Numbers and function keys may be selected, but missing fields cannot be selected, unlike the field_choose().

The range of fields the user can cursor between is given by the row and column fields in the map, which are set using MAPEDIT. To display fields that you do not want the user to access, use field numbers outside this range. If either of the row or column values are zero, the function returns ESCAPE without stopping.

The more general function map_g_choose() can be used to grey-out options, preventing the user from selecting them.

The function map_choose() is implemented with a call to map_g_choose() using the global variable choose_any_option as the parameter banned_list.

Return values

Returns the value of the global variable abort_code

See also

map_g_choose(), field_choose()

Example

if (!map_choose(1,&option))
{
/* Process option selected by the user */
switch (option)
{
case 1:
break;
case 2:
break;
default:
break;
}
}