Updated November 2013; see History
cformat switch: T (standard) or T+ (extended) or T3+ (three-state extended) or T++ (extra extended)
An editable checkbox is represented in the data and answer arrays by a one-character column coded according to the following table:
Code |
Description |
0 |
Unchecked |
1 |
Checked |
2 |
Indeterminate |
4 |
Unchecked, disabled |
5 |
Checked, disabled |
6 |
Indeterminate, disabled |
. |
A space blanks out the cell entirely |
Note: values in the above table are strings ("0", "1", etc.), not binary values.
Extended 2-state checkboxes (T+) and 3-state checkboxes (T3+) support the following additional mouse & keyboard commands:
• When the focus is on a checkbox cell, Ctrl+A sets (ticks) all the enabled checkboxes in the column.
• When the focus is on a checkbox cell, Ctrl+B resets (clears) all the enabled checkboxes in the column.
• When the focus is on a checkbox cell, Ctrl+Z reverses the action of the immediately preceding Ctrl+A, Ctrl+B, or Shift+Click.
• To set (tick) a range of checkboxes in the same column, click to set the first checkbox in the normal way, then Shift+Click on the last checkbox in the range. Since this technique only works to set checkboxes, you the checkboxes at either end of the range must be unset to start with (because the click operation toggles the setting).
Extra-extended (T++) 2-state or 3-state checkbox columns will have a 3-state checkbox added to the header of the column which is automatically set to the checked state if all the boxes in the column are checked; the unchecked state if all the boxes are unchecked, or the indeterminate state if there is a mixture (or if all of the boxes are indeterminate), as in this example:
Clicking the checkbox in the header cycles through the check-all, uncheck-all, set-all-to-indeterminate (if 3-state), and back to the original mixed state (if applicable).
The following special context menu commands (see PopupMenu) relate specifically to extended checkboxes:
• $CBSET acts like Ctrl+A (sets all checkboxes in the column over which the mouse was right-clicked to bring up the context menu). If the menu is activated by right-clicking on any column other than an extended checkbox column, this option will not appear on the menu.
• $CBRST is like $CBSET, but acts like Ctrl+B (reset or clear all checkboxes)
• $CBUNDO acts like Ctrl+Z. Like $CBSET and $CBRST, it will only appear in the menu if the menu is activated for an extended checkbox column. In addition, if undo is not possible, the option will be grey.
• $CBSETDEP is like $CBSET, but applies only to the dependents of the current item. If the item clicked has no dependents, the option will be grey. If the tree is not multi-level (XTF_MLVL not set – see Flags), the option will not appear at all.
• $CBRSTDEP is like $CBSETDEP, but resets rather than sets the dependent checkboxes.
Because the above context menu commands adjust to the runtime circumstances, they can be added to the common PopupMenu for a tree, without regard to whether the tree even contains extended checkboxes, rather than having to add them only to column-specific context menus. The only reason why these items weren’t just automatically defined for extended checkbox columns is to allow you to define the wording. For example, for a tree in which the items represented styles of products, grouped into categories, you might define the context menu items as follows:
Coldef = "0~0~x~H~PopupMenu=Order all styles,$CBSET;Cancel all,$CBRST;"; &
+ "Order all styles in category,$CBSETDEP;Cancel all in category;$CBRSTDEP; &
+ "Undo;$CBUNDO~~"
The context menu might then appear as:
Notes
• You must also specify the flag XTF_EDITABLE when using checkboxes.
• If the checkbox column supports cell colors (cformat code B) then the column data (in both the data and answer arrays) should be two characters wide (instead of one), with the first character reserved for the color code.
• Use Cformat code t for non-editable checkbox, and code 3 for three-state checkboxes.
History
2016 October, A-Shell 6.3.1530.6: Column ordering for all the columns (up to the max of 100) can now be saved when using the TreeID mechanism with the XTUCFG_COLORD bit set in the XTR'USRCFG field. Previously the limit was 31 columns, which remains the limit when using the XTR'COLORDER() array method without the TreeID option.
2016 October, A-Shell 6.3.1530.5: Extended checkbox columns may now be extended to a second degree by adding a second "+" (e.g. T++ or T3++). This adds a 3-state checkbox to the header of the column which is automatically set to the checked state if all the boxes in the column are checked; the unchecked state if all the boxes are unchecked, or the indeterminate state if there is a mixture (or if all of the boxes are indeterminate). Clicking the checkbox in the header cycles through the check-all, uncheck-all, set-all-to-indeterminate (if 3-state), and back to the origional mixed state (if applicable).
2013 October, A-Shell 6.1.1363: The PopupMenu options $CBSET, $CBRST, and $CBUNDO now return EXITCODE=-48 and XTR'XVALIDATE=3 when validation (conditional or unconditional) is active for the column. $CBSETDEP and $CBRSTDEP return XTR'XVALIDATE=4.