Reference Guide > W Routines > WMenu Function (UNIX)
  

WMenu Function (UNIX)
Displays a menu inside the current window whose choices are given by the elements of a string array and which returns the index of the user’s response.
Usage
result = WMenu(strings)
Input Parameters
strings — A string array, with each element containing the text of one menu choice. Both the maximum number of elements and the maximum element length are constrained by how large a display area will be used.
Returned Value
result — A value ranging from 0 to the number of elements in strings minus one. The value –1 is returned, if no menu item was selected.
Keywords
Initial_Selection — The index of the initial selection.
*If this keyword is specified and within the range of strings indices, the initial menu display is made with the designated item selected.
*If this keyword is not specified, the menu is initially displayed with the mouse cursor at the immediate left of the first (top) selection.
Title — The index of the strings element that is the title, normally 0. The title element is not selectable and is displayed reversed and centered. If this keyword is omitted, all items are selectable.
XPos — (X Window System only) The position on the x-axis of the display device where the menu is to be placed.
YPos — (X Window System only) The position on the y-axis of the display device where the menu is to be placed.
Discussion
The WMenu function can be used only with X Window System displays. To use, select a menu item with the mouse and click the left mouse button.
Example
The following statement displays a menu containing the selections Yes and No and entitled Do you wish to continue?:
i = WMENU(['Do you wish to continue?', 'Yes', 'No'], Title=0, $
   Init=1) 
The menu is displayed with Yes initially selected. The result is as follows:
*1 — if the user clicks on Yes.
*2 — if the user clicks on No.
*–1 — if the user clicks the left mouse button outside the menu.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.