Choice menu user input



Release:

4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5


For the classes of nodes that can be used for parametric analysis, such as decision and variable, the expr menu includes the Choice option. The Choice option provides a way to offer the user a choice of selecting one or all values from a list.

Creating a menu from a list: If the original variable is already defined as a list of numbers or labels, create a popup menu to select from the list as follows:

  1. Show the definition of the variable as a list, either in the Attribute view or the Object window.
  2. Click the expr menu and select the Choice option. Click OK to the question “Replace current definition with a Choice?” and click OK again to “Replace current definition?” when prompted.
    List to Choice.png
  3. The Object Finder dialog displays with parameter I = Self and n = 1. Click OK.
    At this step you can also change the selection to MultiChoice before pressing OK if you want to allow the user to select any subset of the option.

The definition field of the original variable now displays as a popup menu, and in browse mode, the input node displays as a popup menu. The original definition (list of numbers or labels) is now available as the domain of the variable — the possible outcomes. In the expression view, the popup menu displays as the Choice function

Tip
To enable the selection of multiple items, where your user can select any subset of items, select MultiChoice during Step 3.
Tip
To define Var1 as a popup menu of another variable Var2, that is defined as a list, select Choice from the expr menu, and set the first parameter to I = Var2 in the Object Finder dialog).
Tip
To hide the All option on the popup, enter inclAll = False as the third parameter in the Object Finder dialog.

Creating a new definition: If a variable has no previous definition, when you select Choice from the expr menu, a domain (possible outcomes) is created with a list of Explicit Values, with one element in the list.

To change the domain to List of numbers, press the Domain value type popup to the right of the Explicit Values pop-up and select Numbers.

Edit the list of values as you would edit a list of labels or list of numbers.

Chapter9 8.png

Note: The values in the domain are evaluated deterministically.

See Also


Comments


You are not allowed to post comments.