dCheckList is a variation of a dListBox that allows you to select/deselect items by means of a checkbox on each row.
Some of the more useful properties for dCheckList:
- MultipleSelect - (bool): When
True, the user can select multiple items at once. When
False, selection is limited to a single item.
- Choices (list): This determines the options available for the control. You can only get/set this, not append.
- Keys (dict / list / tuple): Value that is associated with the
Choices. Many times you want to present the user with a list of choices that mean something to them, but internally in your program, you really need the ID or primary key or some other identifying value that is associated with the choice that the user made. The easiest way to set up the
Keysproperty is to make it a 1:1 list of values that correspond position-wise to the
Choiceslist. This way, when the user selects, say, the third choice in the list,
KeyValuewill return the third value in the Keys list.
- StringValue (str): Returns the text displayed by the control for the selected item.
- PositionValue (int): Returns the position of the selected item in the list of available
- KeyValue (varies): Returns the value in
Keysthat corresponds to the selected item.
- ValueMode (str): Can be one of
Key. Determines the result returned by accessing the
KeyValue. You can always refer to any of those different value types, but when you know which value your program will be needing, you can set
ValueMode, and afterwards just have the normal
Valuebinding work correctly.
Some of the more useful methods for dCheckList:
- selectAll() - (None): Sets all of the items to be marked as selected.
- selectNone() and clearSelections() - (None): Sets all of the items to be marked as not selected. Both method names refer to the same method; they are included for naming consistency across classes.
- invertSelections() - (None): Reverses the selection state for all items in the list.
See the Dabo Class Documentation for an exhaustive documentation of this control's Properties, Events and Methods. (Note that this documentation is no longer live, but it's still available via the Internet Archive).