.BG
.VE $Header: /usr3/s/current/s/.help/RCS/menu,v 1.2 83/12/30 19:30:45 rab Exp $
.FN menu
.TL
menu: Menu Interaction Function
.CS
menu(items, actions, how, prompt, force, return)
.PP
.AG items
character vector giving the list of choices on the menu.
.AG actions
optional character vector of the same length as
`items' giving expressions to be executed
if the corresponding item is chosen.
.AG how
integer describing the method of menu use:
1, the default, is to display a printed menu with associated numbers.
The user types the appropriate number to make a selection.
2 through 4 specifies graphical presentation of the menu followed by user
choice using a graphical input device.
Choice 2 draws the menu along the rightmost side of the plot,
3 allows selection from a previously displayed menu, and
4 displays the menu and redisplays it with graphical parameter `col=0'
after the user interaction. On some devices this will overwrite the menu
with the background color, thus erasing it.
.AG prompt
Character string to be printed prompting the user to make a choice.
Default "Which one?".
.AG force
logical, should user be forced to make a choice of one of the menu items.
Default TRUE.
.AG return
logical, after completing the actions associated with `menu',
should execution return to the context it was in prior to executing `menu'.
Default TRUE.
Using `return=FALSE' is recommended
if `menu' is the last action of a macro or source file, since it
prevents a (growing) stack of source files, which may eventually use
up all available file descriptors.
.GR
.RT
If `action' is not supplied by the user, `menu' returns the integer
corresponding to the item the user selected.
If `force' is FALSE and the user makes an invalid selection, 0 is returned.
.EX
items <- c("List Datasets in Work Directory",
   "List Datasets in Save Directory",
   "quit")
actions <- c("ls( )","ls(pos=2)","q")
menu(items,actions)

menu(ls( ),encode("rm",ls( )),
   prompt="Which dataset should be removed?")
.KW plot*
.KW iplot*
.KW macros
.KW session
.WR
