dListBox is a control that displays a single column of items in a scrollable area. The user can select one of the items by clicking on it, or if
True, they can select additional items by control-clicking on them (command-clicking on the Mac).
This control presents a simple, clean interface to the user. It is ideal for smaller lists; with more than a few dozen items it becomes somewhat unwieldy to the user.
- 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.
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).