This function returns a compound widget used to create a menu, and it returns the base ID of the widget. An interactive ENVI Classic session is required to run this function.

Syntax


Result = WIDGET_MENU(Base [, AUTO_MANAGE={0 | 1}] [, BUT_BASES=variable] [, DEFAULT_ARRAY=array] [, DEFAULT_PTR=value] [, /EXCLUSIVE], LIST=string array [, PROMPT=string] [, ROWS=integer], UVALUE=value)

Arguments


Base

This is the ID of the base widget.

Keywords


AUTO_MANAGE (optional)

Use this keyword to specify how ENVI Classic auto-manages the widget with AUTO_WID_MNG. The keyword value specifies if the widget must have a defined value. Setting this keyword to a value of 1 requires that the widget has either a default value or a value that you enter. Setting this keyword to 0 does not require a value. Do not use this keyword for user-managed widgets.

BUT_BASES (optional)

Use this keyword to specify a named variable that holds the returned array of the widget ID of each button. Specifying this keyword allows you to manage each button by making calls to the IDL routine WIDGET_CONTROL.

DEFAULT_ARRAY (optional)

Use this keyword to specify an array indicating the state of each button. A value of 1 indicates the button is set, and a value of 0 indicates the button is not set.

DEFAULT_PTR (optional)

Use this keyword to specify which single button should be set by default.

EXCLUSIVE (optional)

Set this keyword to make the menu items exclusive.

LIST

Use this keyword to specify an array of string values for the menu buttons.

PROMPT (optional)

Use this keyword to specify the prompt string to use for the widget.

ROWS (optional)

Use this keyword to specify the number of rows for the menu. The default value is 1.

UVALUE

Use this keyword to assign a “user value” to the widget. This value may be of any data type and organization. The user value exists entirely for your convenience. For widgets managed by the ENVI Classic function AUTO_WID_MNG, UVALUE is a tag name in the returned anonymous structure. For user-managed widgets, you can set and use UVALUE however you wish. You must set UVALUE for all compound widgets.

Widget Event


When the widget is not auto-managed, if you set EXCLUSIVE, event.result is set to a single value indicating which button was pressed. If you do not set EXCLUSIVE, event.result is a byte array of zeros and ones, where a value of 1 indicates a selected button.

Example


Create a simple compound widget to select one item from a exclusive menu. If the menu item is properly selected, then print the result.

PRO ENVI_WIDGET_MENU_EX
  compile_opt IDL2
  base = widget_auto_base(title='Menu test')
  list = ['Button 1', 'Button 2', 'Button 3', 'Button 4']
  wm = widget_menu(base, list=list, uvalue='menu', /excl, /auto)
  result = auto_wid_mng(base)
  if (result.accept eq 0) then return
  print, 'Menu Selected', result.menu
END

API Version


4.3