Difference between revisions of "Checkbox"
(Update for 4.5 expression/control selector) |
|||
Line 9: | Line 9: | ||
To define a variable as a checkbox, you must type the expression directly into the definition field (e.g., [[Checkbox]](0) ). Once entered, it will display as a checkbox when viewing the definition field. Typically you would then create an input control for the variable (since the purpose of this function is to provide your users when a checkbox on a form). | To define a variable as a checkbox, you must type the expression directly into the definition field (e.g., [[Checkbox]](0) ). Once entered, it will display as a checkbox when viewing the definition field. Typically you would then create an input control for the variable (since the purpose of this function is to provide your users when a checkbox on a form). | ||
− | To define a cell in a table as a checkbox control, view the table from edit mode and then type [[Checkbox]](0). When a table is viewed in edit mode, [[Checkbox]] and [[Choice]] calls display in textual format. When viewed in browse mode, they display as controls. To utilize checkbox controls from tables, you'll need to create an input node for the table, so that the values can be altered when viewing the table from browse mode. | + | == Checkboxes in tables == |
+ | |||
+ | To define a cell in a table as a checkbox control, view the table from edit mode and then type [[Checkbox]](0). | ||
+ | |||
+ | In [[Analytica 4.5]] and later, it will immediately display as a checkbox control as soon as you enter the expression. An expression-control selector appears along the right edge of the table window, near the top, once the control displays. If you need to change or remove the textual expression, use this control to select ''Show expressions''' from edit mode. In browse mode, the cells will always display as controls. The checkbox control will be disabled in browse mode unless your table node also has an input node associated with it. | ||
+ | |||
+ | In [[Analytica 4.4]] and earlier. When a table is viewed in edit mode, [[Checkbox]] and [[Choice]] calls display in textual format. When viewed in browse mode, they display as controls. To utilize checkbox controls from tables, you'll need to create an input node for the table, so that the values can be altered when viewing the table from browse mode. | ||
= Examples = | = Examples = |
Revision as of 19:50, 12 February 2013
New to Analytica 4.2
Checkbox(b)
Defines a variable or table cells to be a checkbox true/false input. The parameter must be a literal value, either 0 or 1. When the user views the definition, or when an input control is created for the variable, the definition displays as a checkbox control -- either an empty square (unchecked) or a square with a checkmark (checked).
When the user clicks on the checkbox control, the value is toggled from 0 (unchecked) to 1 (checked).
To define a variable as a checkbox, you must type the expression directly into the definition field (e.g., Checkbox(0) ). Once entered, it will display as a checkbox when viewing the definition field. Typically you would then create an input control for the variable (since the purpose of this function is to provide your users when a checkbox on a form).
Checkboxes in tables
To define a cell in a table as a checkbox control, view the table from edit mode and then type Checkbox(0).
In Analytica 4.5 and later, it will immediately display as a checkbox control as soon as you enter the expression. An expression-control selector appears along the right edge of the table window, near the top, once the control displays. If you need to change or remove the textual expression, use this control to select Show expressions' from edit mode. In browse mode, the cells will always display as controls. The checkbox control will be disabled in browse mode unless your table node also has an input node associated with it.
In Analytica 4.4 and earlier. When a table is viewed in edit mode, Checkbox and Choice calls display in textual format. When viewed in browse mode, they display as controls. To utilize checkbox controls from tables, you'll need to create an input node for the table, so that the values can be altered when viewing the table from browse mode.
Examples
A diagram containing a checkbox. Pay_bonus is defined as Checkbox(1)
:
A table containing checkbox controls. Each cell in the Cogen column is defined as Checkbox(0)
or Checkbox(1)
.
Notes
When copy/pasting into a table containing checkboxes, if the source data contains values 0, 1, "yes", "no", "true", or "false", the control will remain as a check and just change the current state to match the incoming data. If the source data contains something dramatically different (e.g., 17.3), then the control will be replaced by the value.
If you specify a script attribute for a variable defined using Checkbox, the typescript in that attribute will be executed whenever the user clicks on the control to change its state.
Limitations
A checkbox provides only a scalar option (true/false). Unlike a Choice pulldown, you do not have an All option to propagate both options through the model. For that option, you'll still need to revert to a Choice.
On a checkbox input control, there is not an option to place the checkbox to the left of the label. If you want this layout, you use Set Node Style... to turn off the label on the input control, and then place a text node with the label to the right of the check.
Checkboxes only display for input controls. You can't use a checkbox to present result information in an output control or result table.
As with other input controls, there is no disabled state (i.e., where the control is visible on a form with a grayed-out appearance, and doesn't respond to user input).
Enable comment auto-refresher