DADiSP Worksheet Functions > Function Categories > Menu Functions > MENULIST
Generates a pop-up menu in accordance with the specified parameters.
MENULIST(x, y, fg, bg, "option1", "option2", ..., "optionN")
x |
- |
Optional. An integer, the x-coordinate in text columns. Defaults to |
y |
- |
Optional. An integer, the y-coordinate in text columns. Defaults to |
fg |
- |
Optional. An integer, the color of menu text. Defaults to the system defined color. |
bg |
- |
Optional. An integer, the background color of the menu. Defaults to the system defined color. |
"optionN" |
- |
One or more strings. The menu selection. |
menulist(0,0,"Simple Menu 1", " min~min(W1)"," max~max(W1)")
pops up a menu in the upper-left corner of the screen. There are two selections in the menu. Selecting MIN prints the minimum value of Window 1 at the bottom of the screen. Pressing the down arrow key moves the menu cursor to the selection MAX, and pressing [Enter] prints the maximum value of Window 1 at the bottom of the screen.
menulist(2, "Simple Menu 2", " min~printf('Min of W1 = %g', min(W1))")
pops up a menu centered on the x-axis and 2 rows down with one selection (MIN). Pressing [Enter] causes the line after the tilde (~) to be executed. This line writes MIN of W1 = n at the bottom of the screen where n is evaluated to the value of the minimum of W1. Pressing [Esc] clears any menu.
The upper left-hand corner of the screen is the origin, with coordinates of x=0, y=0. The screen has dimensions of 80 columns by 24 rows. The bottom right-hand corner of the screen has coordinates x=80, y=24. To center the menu, set x and y to
MENULIST can provide the same functionality as MENUFILE except the dialog box specification is a list of strings instead of a filename. For example, consider the following file based dialog:
// test.pan - file based menu
@panel
{defvar('myvar', 10)}
File Based Menu
Input <w=30 d=0>~myvar = <{myvar}>~input(2)
<L>
~menuclear
// end of test.pan
The dialog is invoked with MENUFILE:
menufile("test.pan")
The same dialog box can be created with MENULIST using a list of strings to specify the dialog box:
menulist("@panel", "{defvar('myvar', 10)}", "String Based Menu", "Input <w=30 d=0>~myvar = <{myvar}>~input(2)", "<L>", "~menuclear")
See Creating DADiSP Menus for more details on dialog box creation and implementation.