WoVariableOptionMenu Function
Creates an option menu containing the names of all of the variables associated with the current tool.
Usage
widget = WoVariableOptionMenu(parent, toolname)
Input Parameters
parent — Specifies the parent widget ID of the option menu (long).
toolname — (string) Specifies the unique name of the VDA Tool to which the option menu is to be attached.
Returned Value
widget — The widget ID of the option menu.
Keywords
Start_Value — Specifies a string containing the name of the initially selected variable.
Variables — A 1D string array containing the names of variables to list in the option menu. By default, the list of variables returned by TmEnumerateVars is used.
Attachment Keywords
Bottom — If a widget ID is specified (for example, Bottom=wid), then the bottom of the option menu is attached to the top of the specified widget. If no widget ID is specified (for example, /Bottom), then the bottom of the option menu is attached to the bottom of the parent widget.
Left — If a widget ID is specified (for example, Left=wid), then the left side of the option menu is attached to the right side of the specified widget. If no widget ID is specified (for example, /Left), then the left side of the option menu is attached to the left side of the parent widget.
Right — If a widget ID is specified (for example, Right=wid), then the right side of the option menu is attached to the left side of the specified widget. If no widget ID is specified (for example, /Right), then the right side of the option menu is attached to the right side of the parent widget.
Top — If a widget ID is specified (for example, Top=wid), then the top of the option menu is attached to the bottom of the specified widget. If no widget ID is specified (for example, /Top), then the top of the option menu is attached to the top of the parent widget.
Discussion
The first option menu item is labelled None.
The variable name option menu cannot be modified once it has been created, except to set the current selection. If the list of variable names changes, the option menu must be recreated.
Note: |
Do not use WwSetValue with the Userdata keyword on the returned widget or on its parent widget after calling this routine. This use will cause unexpected side-effects, because WwSetValue changes the user data for a widget and for all of its children. |
Example
This example creates a variable option menu inside a layout widget. The menu contains the names of the variables associated with the VDA Tool to which the menu is attached.
PRO OkApplyCB, wid, which
; ...
; Retrieve the currently selected variable from the option
; menu. The returned value will be a string containing the
; variable name.
VariableWid = WwGetValue (wid, /Userdata)
variable = WoVariableOptionMenuGetValue (VariableWid)
; ...
END
PRO ChangeVariableCB, wid, which
; ...
; Set the currently selected variable name in the variable
; option menu. The new variable name should be a string con
; taining the name of an existing WAVE variable.
VariableWid = WwGetValue (wid, /Userdata)
WoVariableOptionMenuSetValue, VariableWid, new_index
; ...
END
PRO CreateStuff
TmInit
tool_name = 'CreateStuff'
; ...
top = WwInit ('example', 'Example', layout)
; Create a variable option menu as a child of the layout. The
; option menu will contain all of the variable names
; associated with the tool, and another entry labeled "None".
VariableWid = WoVariableOptionMenu (layout, tool_name)
; ...
status = WwSetValue (top, /Display)
WwLoop
END
See Also
TmEnumerateVars, WoVariableOptionMenuGetValue,
WoVariableOptionMenuSetValue