This function returns a compound widget that displays a drop-down list. The function returns the base ID of the widget, and an interactive ENVI Classic session is required to run it.

Syntax


Result = WIDGET_PMENU(Base [, AUTO_MANAGE={0 | 1}] [, DEFAULT=value], LIST=string array [, LOOKUP=array] [, PROMPT=string], UVALUE=value [, XSIZE=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.

DEFAULT (optional)

Use this keyword to specify the index entry of the default menu selection.

LIST

Use this keyword to specify a string array of drop-down list items. For the best results, pad list items with spaces to make all items equal in length.

LOOKUP (optional)

Use this keyword to specify an array of values associated with each menu item.

PROMPT (optional)

Use this keyword to specify the prompt string to be used for the widget.

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.

XSIZE (optional)

Use this keyword to specify the width of the widget, in characters.

Widget Event


When the widget is not auto-managed, widget events set event.result to the index of the selected menu item.

Example


Create a simple compound widget with a drop-down list. When you click OK, print the selected menu item.

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

API Version


4.3