Difference between revisions of "Choice menus and Checkboxes in an edit table"
Line 5: | Line 5: | ||
You can include a drop-down (pull-down) menu in any cell of an edit table to let end users select an option for each cell. Here is an example, in browse mode. | You can include a drop-down (pull-down) menu in any cell of an edit table to let end users select an option for each cell. Here is an example, in browse mode. | ||
− | [[File:Chapter11_74.jpg]] | + | :[[File:Chapter11_74.jpg]] |
You use the [[Choice]]() function in the edit table cells, similar to using [[Choice]] to specify a single menu for a variable: | You use the [[Choice]]() function in the edit table cells, similar to using [[Choice]] to specify a single menu for a variable: | ||
Line 15: | Line 15: | ||
'''''Note: '''When you enter the cell definition, the choice control displays immediately. You may want to edit the textual expression to make a change, or to copy the textual expression for pasting into other cells. In edit mode you can toggle between the viewing the control and the textual expression using the expression/control selector. Note that the selector is not present in browse mode, or when no cells with controls are visible.''<br /> | '''''Note: '''When you enter the cell definition, the choice control displays immediately. You may want to edit the textual expression to make a change, or to copy the textual expression for pasting into other cells. In edit mode you can toggle between the viewing the control and the textual expression using the expression/control selector. Note that the selector is not present in browse mode, or when no cells with controls are visible.''<br /> | ||
− | [[File:Chapter11_75.jpg]]</li> | + | :[[File:Chapter11_75.jpg]]</li> |
<li> Copy and paste <code>Choice(k, 1, 0)</code> from the first cell to any others you want also to contain the menu. You can also use other indexes than '''k '''if you want to include menus with other options. Here is an example containing drop-down menus in some but not all cells, with ''Show Expressions ''selected.<br /> | <li> Copy and paste <code>Choice(k, 1, 0)</code> from the first cell to any others you want also to contain the menu. You can also use other indexes than '''k '''if you want to include menus with other options. Here is an example containing drop-down menus in some but not all cells, with ''Show Expressions ''selected.<br /> | ||
− | [[File:Chapter11_76.jpg]]</li> | + | :[[File:Chapter11_76.jpg]]</li> |
<li>Select '''X''', then select '''Make Input '''from the '''Object '''menu to make an input node for it. Move the input node to a good location. You will usually want an input node so the selections can be changed when the table is viewed in browse mode.</li></ol> | <li>Select '''X''', then select '''Make Input '''from the '''Object '''menu to make an input node for it. Move the input node to a good location. You will usually want an input node so the selections can be changed when the table is viewed in browse mode.</li></ol> | ||
Line 27: | Line 27: | ||
==See Also== | ==See Also== | ||
+ | * [[Choice]] | ||
* [[To edit a table]] | * [[To edit a table]] | ||
* [[Inserting Choice Controls in Edit Table Cells]] | * [[Inserting Choice Controls in Edit Table Cells]] | ||
+ | * [[Choice menu user input]] | ||
* [[Creating_the_Party_Problem_Model#Defining_Party_Location_as_a_list_of_labels|Defining Party Location as a list of labels]] | * [[Creating_the_Party_Problem_Model#Defining_Party_Location_as_a_list_of_labels|Defining Party Location as a list of labels]] | ||
<footer>Subscript and slice of a subarray / {{PAGENAME}} / Shortcuts to navigate and edit a table</footer> | <footer>Subscript and slice of a subarray / {{PAGENAME}} / Shortcuts to navigate and edit a table</footer> |
Revision as of 01:02, 1 March 2016
You can include a drop-down (pull-down) menu in any cell of an edit table to let end users select an option for each cell. Here is an example, in browse mode.
You use the Choice() function in the edit table cells, similar to using Choice to specify a single menu for a variable:
- Create a variable X as an edit table, in the usual way, selecting Table from the expr menu above its definition.
- Create an index variable, e.g., k, containing the list of options you want to make available from the menu(s), usually as a list of numbers or a list of labels.
- In the edit table of X, in edit mode, enter
Choice(k, 1, 0)
into the first cell that you want to contain a menu. The second parameter 1 means that the first element of k is the default option. The third parameter 0 means that it does not show All as an option, normally what you want. Note: When you enter the cell definition, the choice control displays immediately. You may want to edit the textual expression to make a change, or to copy the textual expression for pasting into other cells. In edit mode you can toggle between the viewing the control and the textual expression using the expression/control selector. Note that the selector is not present in browse mode, or when no cells with controls are visible.
- Copy and paste
Choice(k, 1, 0)
from the first cell to any others you want also to contain the menu. You can also use other indexes than k if you want to include menus with other options. Here is an example containing drop-down menus in some but not all cells, with Show Expressions selected.
- Select X, then select Make Input from the Object menu to make an input node for it. Move the input node to a good location. You will usually want an input node so the selections can be changed when the table is viewed in browse mode.
Tip
The variable containing the edit table with menus should always have an input node — otherwise, you won’t be able to select from the menus or edit other cells in browse mode.Note: You can also insert checkbox controls into table cells using the same steps. Enter the expression Checkbox(0)
or Checkbox(1)
directly into a cell.
See Also
- Choice
- To edit a table
- Inserting Choice Controls in Edit Table Cells
- Choice menu user input
- Defining Party Location as a list of labels
Comments
Enable comment auto-refresher