|
Purpose |
Picks an option from a fixed list of records | ||
|
Old name |
#define pick_optlist pick_list | ||
|
Syntax |
int pick_list(mapnr, extra_map, show_item, | ||
|
Parameters |
int mapnr |
Number of display map | |
|
|
int extra_map |
Number of extra map to display | |
|
|
void (show_item*)(int, int, int) |
Pointer to function to call to display data | |
|
|
int item_count |
Total number of items in list | |
|
|
int choices |
Number of choices that can be displayed on the map | |
|
|
int* option_nr |
Pointer to variable to hold the item number selected by the user | |
|
|
int flags |
Parameter specifying display attributes and options | |
|
|
ADDITIONAL |
Number of mnemonic map (required when parameter flags is set to ABORT_MNEMONICS) | |
|
|
The parameter flags can take the same values as for pick_record(), and the values have the same meaning except that: NO_DISP means the menu is on the screen, but the fields are redisplayed; NO_DISP+NO_READ means the menu is on the screen and the fields are correct. | ||
|
Description |
The function pick_list() is similar to the pick_record() function, but is used where the number of items in the list is known before the call is made. This function differs from the function pick_record() in the following respects:
A user-defined function for displaying records is, however, required as with the function pick_record(). The display function is called by pick_list() to display each item in the appropriate way. If the user selects a record the variable pointed to by the parameter option_nr is set to the selected field. Counting starts from 0. The initial value determined by the parameter option_nr indicates which field is highlighted when the map specified by the parameter choice is first displayed. | ||
|
Return values |
The return value indicates the key chosen, as follows: | ||
|
|
Return Value |
Key Pressed | |
|
|
0 |
If the <Enter> key is pressed | |
|
|
ESCAPE |
If <Esc> is pressed | |
|
|
F<n> |
Function key <n> is pressed (used when parameter flags includes the value ABORT_FUNC_KEYS) | |
|
|
PAGE UP |
If there are no records | |
|
|
INSERT |
If <Ins> is pressed, or <Enter> is pressed over the 'new record' message (used when parameter flags include the values ALLOW_NEW or ABORT_MNEMONICS) | |
|
|
DELETE |
If <Del> is pressed (used when parameter flags includes the value ALLOW_DELETE) | |
|
|
The global variable abort_code is zero after a call to the function pick_list() | ||
|
See also |
|||
|
Example |
| ||