INTEGER FUNCTION GETMENU( ITEMCNT, DEFAULT, PROMPT, CHOICES ) INTEGER , INTENT(IN ) :: ITEMCNT ! number of choices INTEGER , INTENT(IN ) :: DEFAULT ! Default return value CHARACTER*(*), INTENT(IN ) :: PROMPT ! Prompt for user CHARACTER*(*), INTENT(IN ) :: CHOICES( ITEMCNT ) ! array of menu choice strings
PROMPT
, get
the user's response, check that it is within range, and return it.
Return DEFAULT
if the user hits <RET>.
Reprompts on error for up to 5 attempts; exits in case of more than
5 entry errors. If environment
variable PROMPTFLAG is set to "N", returns
DEFAULT
without prompting the user. Logs the value
returned, for tracking and validation purposes.
The number for the default response is displayed in square
brackets at the end of the prompt [LIKE THIS]
NOTE: prompt and menu choice strings should have length at most 72 characters. Ideally, number of items should be at most 18; should be at most 999, in any case.
See also GETYN() , GETNUM() , GETREAL() , GETDBLE() , and GETSTR() .
USE M3UTILIO
(See sample programs LATLON or PRESZ for additional usage examples.)
... INTEGER L INTEGER GETMENU CHARACTER*72 CHOICES( 4 ) DATA CHOICES & / 'This is the first choice', & 'This is the second choice', & 'This is the third choice', & 'This is the last choice' / ... L = GETMENU( 4, 1, 'Choose one' ) ...
To: Models-3/EDSS I/O API: The Help Pages