DADiSP Worksheet Functions > Function Categories > Menu Functions > MENULIST

 

MENULIST

Purpose:

Generates a pop-up menu in accordance with the specified parameters.

Syntax:

MENULIST(x, y, fg, bg, "option1", "option2", ..., "optionN")

x

-

Optional. An integer, the x-coordinate in text columns. Defaults to -1 (centered).

y

-

Optional. An integer, the y-coordinate in text columns. Defaults to -1 (centered).

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.

Example:

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.

Example:

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.

Remarks:

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 -1.

 

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.

See Also:

ECHO

INPUT

MENUCLEAR

MENUDELETE

MENUFILE

MENUPRINT

OBJECTLIST

PDCHISTORY

VIEWFILE